doctrine

PHP Symfony2 add 60 years to the both day Datetime object of a person

房东的猫 提交于 2019-12-12 02:43:23
问题 I need to add 60 Years to the date of birth of a person/worker, this person is stored in the database and I have the following code to define this person plus the getters and setters: /** * @ORM\Entity * @ORM\Table(name="Worker") * @ORM\Entity(repositoryClass="Osd\RetireBundle\Entity\WorkerRepository") */ class Worker { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ private $idWorker; /** * @ORM\Column(type="string", length=20) */ private $omang; /** *

Doctrine record unknown exception in a Symfony 1.4 backend admin module

☆樱花仙子☆ 提交于 2019-12-12 02:32:06
问题 I am facing a problem with the admin generator and I am unable to get my way around this after 3 hours of brainstorming and exploring. The error reads as: 500 | Internal Server Error | Doctrine_Record_UnknownPropertyException Unknown record property / related component "option1" on "Questions" Looking up the WWW, I got a gist of possible alternatives. None of which seem like the answer. option1, does exist under Questions schema. However, it is option_1 so I am not sure why it says option1.

Symfony, ODM: how to set multiply ids annotation

眉间皱痕 提交于 2019-12-12 02:18:00
问题 So the question is how to provide two or more identifiers keys? I couldn't find any answers on this question in google search... Here is example: class Customer { /** * @ODM\Id * * @JMS\Expose * @JMS\Type("string") * */ protected $id; /** * @var integer * @ODM\Id(strategy="INCREMENT") * * @JMS\Expose * @JMS\Type("integer") * */ protected $customerId; So in this case I have second id which increment as I wrote, but first id became null. If I remove and write just * @ODM\Field(type="integer")

324 No response error in Ubuntu 10.04, but works in Windows

ぐ巨炮叔叔 提交于 2019-12-12 01:56:38
问题 I am using Zend Framework (1.11.11) with Doctrine (1.2.4) and two operating systems (Ubuntu 10.04 and Windows XP) and there is a strange behaviour in my application. I try do do 2 basic things (This is the part of my IndexController): $this->view->items = Doctrine::getTable('Prelekcje')->findAll(); // 1 line $this->view->item = Doctrine::getTable('Prelekcje')->find(2); // 2 line On Windows it works properly and I don't have any troubles. In Linux (Ubuntu) first line works - I get the data

doctrine unknow relation alias on innerjoin

天大地大妈咪最大 提交于 2019-12-12 01:48:25
问题 this is my database: When I try with mysql this query all goes good: SELECT * FROM privati AS p INNER JOIN richiestepreventivo AS r ON p.id = r.idPrivato WHERE r.idImpresa = xx But If I do: $qr = Doctrine_Query::create() ->select('*') ->from('privati as p') ->innerJoin('richiestepreventivo as r ON p.id=r.idPrivato ') ->where('r.idImpresa=' . $idI); But gives me this error: Unknown relation alias This is my YAML file: --- detect_relations: true options: collate: latin1_swedish_ci charset:

i got this error 500 | Internal Server Error | Doctrine_Connection_Mysql_Exception

家住魔仙堡 提交于 2019-12-12 01:46:38
问题 when i am update my form, i got this error 500 | Internal Server Error | Doctrine_Connection_Mysql_Exception executeEdit public function executeEdit(sfWebRequest $request) { $this->form = new ContactForm(); $this->rs = Doctrine::getTable('login')-> find($request->getParameter('id')); $id=$request->getParameter('id'); $unm=$this->rs['username']; $msg=$this->rs['message']; $em=$this->rs['email']; $sub=$this->rs['subject']; $this->form->setDefault('id', $id); $this->form->setDefault('username',

How to Extend a Fieldset in ZF2 to work with Doctrine’s Class Table Inheritance mapping strategy

故事扮演 提交于 2019-12-12 01:44:41
问题 I’m developing a project using Doctrine’s Class Table Inheritance mapping strategy which involves joining a parent table with one of a number of child tables depending on the value in a discriminator column in the parent table. I’ve got a working prototype in which the unique conglomerate fieldsets each contain duplicate copies of all of the code for the common elements from the parent entity. In order to ensure consistency and avoid excess code I want to change the fieldsets so that I have a

Symfony2 doctrine GROUP BY

岁酱吖の 提交于 2019-12-12 01:34:15
问题 I create a MONTH function to extract month of a date. I want to GROUP BY the result with these query: SELECT MONTH(p.publicationDateStart) AS archive FROM ApplicationSonataNewsBundle:Post p GROUP BY archive But it gives me error: An exception has been thrown during the rendering of a template ("Notice: Undefined index: archive in /home/kiddo/Code/apache2/work/ibctal.dev/vendor/doctrine/orm/lib/Doctrine/ORM/Query /SqlWalker.php line 2197") in ApplicationSonataNewsBundle:Post:archive.html.twig

Symfony 2 Form not saving data from select (on joined table)

为君一笑 提交于 2019-12-12 01:32:30
问题 I have created a form that appears to be correct, it has a few text fields and a select box with a list of countries pulled from a table of countries I have. The select box displays correctly using the the correct values for it's 'value' and display text. When I submit the form however I get an exception: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'countryid' cannot be null If I set the database table (in PHPMyAdmin) to allow a null value for the countryid field it enters

Added columns to Doctrine Entity (Symfony 2.6 standard) are not recognized by doctrine

时间秒杀一切 提交于 2019-12-12 01:27:05
问题 I have an entity in my symfony2 app with more than a few attributes. It implements JSONserializable, since all the work on the entity is done on the javascript side, and I have a magic setter function defined so I can loop through the JSON I'm getting from the client and set all of my attributes at once. The Class definition: /** *@ORM\Entity *@ORM\Table(name="creature") */ class Creature implements JsonSerializable { And the atypical function definitions: public function __set($name, $value)