1
0
mirror of synced 2024-12-04 18:56:06 +03:00

Fix: generated IDs are converted to integer

This commit is contained in:
Josef Kříž 2015-03-23 17:51:04 +01:00
parent d1a695b42b
commit e57be9da5e
4 changed files with 15 additions and 4 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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];

View File

@ -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;