doctrine-orm

It seems I have two Doctrine Entity Managers but I want only one! o.O

白昼怎懂夜的黑 提交于 2020-02-08 07:54:50
问题 I've spent last days solving a very subtle bug in my bundle. Practically I get a Job entity from the database. This entity has a one-to-one , self-referencing relation to another Job entity on the property retryOf . When I try to update the retrieved Job#status property, I get the following exception thrown: [Doctrine\ORM\ORMInvalidArgumentException] A new entity was found through the relationship 'SerendipityHQ\Bundle\CommandsQueuesBundle\Entity\Job#retryOf' that was not configured to

How to renumber a column in doctrine

社会主义新天地 提交于 2020-02-07 03:41:09
问题 I am developing a project in zf2 using doctrine and I need to create a method to renumber the order field so that the values are sequential. Before: +-----+-------+--------+------------+ | id | order | item | collection | +-----+-------+--------+------------+ | 987 | 1 | apple | fruits | | 46 | 2 | banana | fruits | | 394 | 7 | grape | fruits | | 265 | 30 | pear | fruits | | 89 | 1 | squash | vegetables | +-----+-------+--------+------------+ After: +-----+-------+--------+------------+ | id

Unable to convert MySql query using doctrine DQL or QueryBuilder

谁说胖子不能爱 提交于 2020-02-04 08:52:43
问题 I cannot convert this query : SELECT c.title, COUNT(*), ( SELECT ba_thumb.link FROM ba_video INNER JOIN video_channel ON video_channel.video_id=ba_video.id INNER JOIN ba_thumb ON ba_thumb.video_id=video_channel.video_id INNER JOIN ba_channel ON ba_channel.id=video_channel.channel_id WHERE video_channel.channel_id=c.id ORDER BY ba_video.views DESC, ba_thumb.id ASC LIMIT 1 ) AS ba_thumb_link FROM ba_channel c INNER JOIN video_channel ON video_channel.channel_id=c.id INNER JOIN ba_video ON ba

Unable to convert MySql query using doctrine DQL or QueryBuilder

陌路散爱 提交于 2020-02-04 08:51:31
问题 I cannot convert this query : SELECT c.title, COUNT(*), ( SELECT ba_thumb.link FROM ba_video INNER JOIN video_channel ON video_channel.video_id=ba_video.id INNER JOIN ba_thumb ON ba_thumb.video_id=video_channel.video_id INNER JOIN ba_channel ON ba_channel.id=video_channel.channel_id WHERE video_channel.channel_id=c.id ORDER BY ba_video.views DESC, ba_thumb.id ASC LIMIT 1 ) AS ba_thumb_link FROM ba_channel c INNER JOIN video_channel ON video_channel.channel_id=c.id INNER JOIN ba_video ON ba

Symfony2 (doctrine2) native sql insert

岁酱吖の 提交于 2020-02-03 13:02:23
问题 How to insert data in symfony2 doctrine2 on native sql? My query insert into propriedades (id,name,descripcion,num_lote,cod_imovel,imovel,convenio,proprietar,cpf,area_ha,perimetro,location,centro) VALUES (nextval('propriedades_id_seq'),'?','?','?','?','?','?','?','?','?','?',ST_GeomFromKML('<Polygon><outerBoundaryIs><LinearRing><coordinates>".$terra['coordinates']."</coordinates></LinearRing></outerBoundaryIs></Polygon>'),ST_Centroid(ST_GeomFromKML('<Polygon><outerBoundaryIs><LinearRing>

Symfony2 (doctrine2) native sql insert

不羁岁月 提交于 2020-02-03 13:02:19
问题 How to insert data in symfony2 doctrine2 on native sql? My query insert into propriedades (id,name,descripcion,num_lote,cod_imovel,imovel,convenio,proprietar,cpf,area_ha,perimetro,location,centro) VALUES (nextval('propriedades_id_seq'),'?','?','?','?','?','?','?','?','?','?',ST_GeomFromKML('<Polygon><outerBoundaryIs><LinearRing><coordinates>".$terra['coordinates']."</coordinates></LinearRing></outerBoundaryIs></Polygon>'),ST_Centroid(ST_GeomFromKML('<Polygon><outerBoundaryIs><LinearRing>

How to access one to one embedded form symfony2

我的梦境 提交于 2020-02-03 04:56:05
问题 I used symfony 2 only few days. I got two entities and i want to create one form and save data from this form into database. UserDetails and Contract have relations OneToOne. I embed a form of Contract into UserDetails form (form apper on web) but when i set some data into form and click button "save" i get a error. as i notice a "try" to assign an array instead of Contract i don't know how to access this new contract entite in Controler. example ERRORS: ContextErrorException: Catchable Fatal

Doctrine OneToOne identity through foreign entity exception on flush

二次信任 提交于 2020-02-02 03:09:20
问题 I have User and UserProfile OneToOne–related Doctrine ORM entities. They should always exist as a pair, there should be no User without UserProfile . User should get its id from autoincrement, while UserProfile should have User's id. So they both should have the same id and there is no other column to set up the relationship (Doctrine docs: Identity through foreign Entities). UserProfile's id is both a primary key (PK) and foreign key (FK) at the same time. I managed to set it up, but it

Symfony2: ContextErrorException: Catchable Fatal Error: Argument 1 passed to […]::__construct() must implement interface […] none given

淺唱寂寞╮ 提交于 2020-01-30 11:21:26
问题 The problem: Any time I try to access the application I get this error: ContextErrorException: Catchable Fatal Error: Argument 1 passed to PL\OrderBundle\Entity\OrderHasComment::__construct() must implement interface Symfony\Component\Security\Core\SecurityContextInterface, none given, called in /var/www/html/apps/portal_de_logistica/vendor/sonata-project/doctrine-orm-admin-bundle/Model/ModelManager.php on line 416 and defined in /var/www/html/apps/portal_de_logistica/src/PL/OrderBundle

Persist entity on non persisted field change

浪子不回头ぞ 提交于 2020-01-30 08:17:05
问题 I've an entity with a plainPassword and a password attribute. In form, I map on the plainPassword. After, when the user valid the form, I do password validation on the plainPassword. To encode the password, I use an EventSubscriber that listen on prePersist and preUpdate. It works well for the register form, because it's a new entity, the user fill some persisted attributes, then doctrine persist it and flush. But, when I just want to edit the password, it doesn't work, I think it's because