1
0
mirror of synced 2025-01-18 22:41:43 +03:00

Naive fix

This commit is contained in:
Adrien Brault 2014-11-07 15:00:50 +01:00 committed by Marco Pivetta
parent 4058ad3958
commit fc8191f557
2 changed files with 4 additions and 6 deletions

View File

@ -55,12 +55,8 @@ class AssignedGenerator extends AbstractIdGenerator
}
if (isset($class->associationMappings[$idField])) {
if ( ! $em->getUnitOfWork()->isInIdentityMap($value)) {
throw ORMException::entityMissingForeignAssignedId($entity, $value);
}
// NOTE: Single Columns as associated identifiers only allowed - this constraint it is enforced.
$value = current($em->getUnitOfWork()->getEntityIdentifier($value));
$value = $em->getUnitOfWork()->getSingleIdentifierValue($value);
}
$identifier[$idField] = $value;

View File

@ -76,7 +76,9 @@ final class IdentifierFlattener
$class->associationMappings[$idField]['targetEntity']
);
$associatedId = $this->unitOfWork->getEntityIdentifier($idValue);
$associatedId = $this->unitOfWork->isInIdentityMap($idValue)
? $this->unitOfWork->getEntityIdentifier($idValue)
: $targetClassMetadata->getIdentifierValues($idValue);
$flatId[$idField] = $associatedId[$targetClassMetadata->identifier[0]];
} else {