Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.0-BETA3
-
Component/s: None
-
Security Level: All
-
Labels:None
Description
Affects trunk.
A and B have a One-To-One mapping, with A being the owning side of the relationship. No cascade persist is set.
// Create entity A $a = new A(); $em->persist($pt); $em->flush(); echo "Created A {$b->getId()}\n"; // Create B and add it to A $b = new B(); $a->setB($b); //$em->persist($b); // oops, forgot $em->flush(); echo "Created B {$b->getId()}\n";
Expected: either throw an exception saying that A is attempting to reference an instance of B that is not persisted, or silently ignore the field.
Actual: Cryptic notice:
E_NOTICE (8): Undefined index: 0000000069d80795000000006ebfc57d (Doctrine/ORM/UnitOfWork.php:1903)
Issue Links
- is referenced by
-
DDC-203
Detached entities are recognized as new ones
-
The issue you have is the same as if you use result cache. The entity is not managed by EM.
Maybe an "Entity of class " . get_class($entity) . " not managed by EntityManager." exception is the best solution here.
Cheers,