Disallowing null
as part of the entity identifier
This commit is contained in:
parent
2829174267
commit
1cb8d790b6
@ -1398,12 +1398,13 @@ class UnitOfWork implements PropertyChangedListener
|
||||
public function addToIdentityMap($entity)
|
||||
{
|
||||
$classMetadata = $this->em->getClassMetadata(get_class($entity));
|
||||
$idHash = implode(' ', $this->entityIdentifiers[spl_object_hash($entity)]);
|
||||
$identifier = $this->entityIdentifiers[spl_object_hash($entity)];
|
||||
|
||||
if ($idHash === '') {
|
||||
if (in_array(null, $identifier, true)) {
|
||||
throw ORMInvalidArgumentException::entityWithoutIdentity($classMetadata->name, $entity);
|
||||
}
|
||||
|
||||
$idHash = implode(' ', $identifier);
|
||||
$className = $classMetadata->rootEntityName;
|
||||
|
||||
if (isset($this->identityMap[$className][$idHash])) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user