1
0
mirror of synced 2025-02-10 17:29:27 +03:00

#6284 #6217 removing hacks around the ClassMetadata details - invalid fix that was actually fixing the symptom

This commit is contained in:
Marco Pivetta 2017-08-23 00:25:29 +02:00
parent 07b397f341
commit caa008b61d
No known key found for this signature in database
GPG Key ID: 4167D3337FD9D629

View File

@ -29,7 +29,6 @@ use ReflectionClass;
use Doctrine\Common\Persistence\Mapping\ClassMetadata; use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\ClassLoader; use Doctrine\Common\ClassLoader;
use Doctrine\ORM\Cache\CacheException; use Doctrine\ORM\Cache\CacheException;
use Doctrine\ORM\Cache\AssociationCacheEntry;
/** /**
* A <tt>ClassMetadata</tt> instance holds all the object-relational mapping metadata * A <tt>ClassMetadata</tt> instance holds all the object-relational mapping metadata
@ -715,14 +714,11 @@ class ClassMetadataInfo implements ClassMetadata
*/ */
public function getIdentifierValues($entity) public function getIdentifierValues($entity)
{ {
if ($entity instanceof AssociationCacheEntry) {
throw new \InvalidArgumentException('WTF DUDE: ' . $entity->class . ' - ' . \serialize($entity->identifier));
}
if ($this->isIdentifierComposite) { if ($this->isIdentifierComposite) {
$id = []; $id = [];
foreach ($this->identifier as $idField) { foreach ($this->identifier as $idField) {
$value = $this->getIndentifierValue($entity, $idField); $value = $this->reflFields[$idField]->getValue($entity);
if (null !== $value) { if (null !== $value) {
$id[$idField] = $value; $id[$idField] = $value;
@ -733,7 +729,7 @@ class ClassMetadataInfo implements ClassMetadata
} }
$id = $this->identifier[0]; $id = $this->identifier[0];
$value = $this->getIndentifierValue($entity, $id); $value = $this->reflFields[$id]->getValue($entity);
if (null === $value) { if (null === $value) {
return []; return [];
@ -742,15 +738,6 @@ class ClassMetadataInfo implements ClassMetadata
return [$id => $value]; 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. * Populates the entity identifier of an entity.
* *