1
0
mirror of synced 2024-12-05 03:06:05 +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( $id = array(
$this->class->identifier[0] => $generatedId $this->class->identifier[0] => $generatedId
); );
$postInsertIds[$generatedId] = $entity; $postInsertIds[] = array(
'generatedId' => $generatedId,
'entity' => $entity,
);
} else { } else {
$id = $this->class->getIdentifierValues($entity); $id = $this->class->getIdentifierValues($entity);
} }

View File

@ -180,7 +180,10 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
$id = array( $id = array(
$this->class->identifier[0] => $generatedId $this->class->identifier[0] => $generatedId
); );
$postInsertIds[$generatedId] = $entity; $postInsertIds[] = array(
'generatedId' => $generatedId,
'entity' => $entity,
);
} else { } else {
$id = $this->em->getUnitOfWork()->getEntityIdentifier($entity); $id = $this->em->getUnitOfWork()->getEntityIdentifier($entity);
} }

View File

@ -1019,7 +1019,9 @@ class UnitOfWork implements PropertyChangedListener
if ($postInsertIds) { if ($postInsertIds) {
// Persister returned post-insert IDs // 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); $oid = spl_object_hash($entity);
$idField = $class->identifier[0]; $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 if ( ! is_null($this->mockIdGeneratorType) && $this->mockIdGeneratorType == \Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_IDENTITY
|| $this->class->isIdGeneratorIdentity()) { || $this->class->isIdGeneratorIdentity()) {
$id = $this->identityColumnValueCounter++; $id = $this->identityColumnValueCounter++;
$this->postInsertIds[$id] = $entity; $this->postInsertIds[] = array(
'generatedId' => $id,
'entity' => $entity,
);
return $id; return $id;
} }
return null; return null;