diff --git a/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php index a86f8bc21..7ab1d3b1c 100644 --- a/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php @@ -285,7 +285,10 @@ class BasicEntityPersister implements EntityPersister $id = array( $this->class->identifier[0] => $generatedId ); - $postInsertIds[$generatedId] = $entity; + $postInsertIds[] = array( + 'generatedId' => $generatedId, + 'entity' => $entity, + ); } else { $id = $this->class->getIdentifierValues($entity); } diff --git a/lib/Doctrine/ORM/Persisters/Entity/JoinedSubclassPersister.php b/lib/Doctrine/ORM/Persisters/Entity/JoinedSubclassPersister.php index 2886413fd..b807fbae9 100644 --- a/lib/Doctrine/ORM/Persisters/Entity/JoinedSubclassPersister.php +++ b/lib/Doctrine/ORM/Persisters/Entity/JoinedSubclassPersister.php @@ -180,7 +180,10 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister $id = array( $this->class->identifier[0] => $generatedId ); - $postInsertIds[$generatedId] = $entity; + $postInsertIds[] = array( + 'generatedId' => $generatedId, + 'entity' => $entity, + ); } else { $id = $this->em->getUnitOfWork()->getEntityIdentifier($entity); } diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php index 2a458a3ce..fe12e55df 100644 --- a/lib/Doctrine/ORM/UnitOfWork.php +++ b/lib/Doctrine/ORM/UnitOfWork.php @@ -1019,7 +1019,9 @@ class UnitOfWork implements PropertyChangedListener if ($postInsertIds) { // Persister returned post-insert IDs - foreach ($postInsertIds as $id => $entity) { + foreach ($postInsertIds as $postInsertId) { + $id = $postInsertId['generatedId']; + $entity = $postInsertId['entity']; $oid = spl_object_hash($entity); $idField = $class->identifier[0]; diff --git a/tests/Doctrine/Tests/Mocks/EntityPersisterMock.php b/tests/Doctrine/Tests/Mocks/EntityPersisterMock.php index ac2157b52..761ec4bc1 100644 --- a/tests/Doctrine/Tests/Mocks/EntityPersisterMock.php +++ b/tests/Doctrine/Tests/Mocks/EntityPersisterMock.php @@ -55,7 +55,10 @@ class EntityPersisterMock extends \Doctrine\ORM\Persisters\Entity\BasicEntityPer if ( ! is_null($this->mockIdGeneratorType) && $this->mockIdGeneratorType == \Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_IDENTITY || $this->class->isIdGeneratorIdentity()) { $id = $this->identityColumnValueCounter++; - $this->postInsertIds[$id] = $entity; + $this->postInsertIds[] = array( + 'generatedId' => $id, + 'entity' => $entity, + ); return $id; } return null;