Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Invalid
-
Affects Version/s: 2.3.2
-
Fix Version/s: None
-
Component/s: ORM
-
Labels:
-
Environment:php 5.4.11, MySQL 5.5, ubuntu 12.10
Description
I'm using symfony 2.1.8 and sonata/admin-bundle
I have a quite complex entity mapping.
- A Competence has many CompetenceAction (superclass)
- CompetenceActionBuff is a subclass of CompetenceAction and has exactly one buff (selectable in the form by an 'entity' field).
When i want to edit a Competence, i have the following error message about the Buff entity linked to the CompetenceActionBuff:
"Entities passed to the choice field must be managed. [...]"
The exception is raised in Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php at line 412
I've added some debug code in the EntityManager::contains() method and it shows that my entity is in the entityMap but his oid is not in the keys of entityIdentifiers making the call to UnitOfWork::isInIdentityMap() return false at line 1505.
When submitting the form, there is no problems. All the entities are correctly created in the database. The exception is thrown only when i want to edit the Competence object. Saying that the Buff object is not managed when it was first loaded from the database... strange, no?
Finally, i tried to comment the test
if (!$this->em->contains($entity)))
in EntityChoiceList::getIdentifierValues() and everything seemed to work properly.