From caa008b61d25840057698442a8a63e8c8e997d19 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Wed, 23 Aug 2017 00:25:29 +0200 Subject: [PATCH] #6284 #6217 removing hacks around the `ClassMetadata` details - invalid fix that was actually fixing the symptom --- lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index 4057455b3..b5eebcdde 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -29,7 +29,6 @@ use ReflectionClass; use Doctrine\Common\Persistence\Mapping\ClassMetadata; use Doctrine\Common\ClassLoader; use Doctrine\ORM\Cache\CacheException; -use Doctrine\ORM\Cache\AssociationCacheEntry; /** * A ClassMetadata instance holds all the object-relational mapping metadata @@ -715,14 +714,11 @@ class ClassMetadataInfo implements ClassMetadata */ public function getIdentifierValues($entity) { - if ($entity instanceof AssociationCacheEntry) { - throw new \InvalidArgumentException('WTF DUDE: ' . $entity->class . ' - ' . \serialize($entity->identifier)); - } if ($this->isIdentifierComposite) { $id = []; foreach ($this->identifier as $idField) { - $value = $this->getIndentifierValue($entity, $idField); + $value = $this->reflFields[$idField]->getValue($entity); if (null !== $value) { $id[$idField] = $value; @@ -733,7 +729,7 @@ class ClassMetadataInfo implements ClassMetadata } $id = $this->identifier[0]; - $value = $this->getIndentifierValue($entity, $id); + $value = $this->reflFields[$id]->getValue($entity); if (null === $value) { return []; @@ -742,15 +738,6 @@ class ClassMetadataInfo implements ClassMetadata return [$id => $value]; } - private function getIndentifierValue($entity, $id) - { - if ($entity instanceof AssociationCacheEntry) { - return $entity->identifier[$id]; - } - - return $this->reflFields[$id]->getValue($entity); - } - /** * Populates the entity identifier of an entity. *