From 28791620157c413e9dce23663a064eeb012061e3 Mon Sep 17 00:00:00 2001 From: Sander Marechal Date: Thu, 20 Jun 2013 14:00:58 +0200 Subject: [PATCH] No need to lookup metadata --- lib/Doctrine/ORM/PersistentCollection.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Doctrine/ORM/PersistentCollection.php b/lib/Doctrine/ORM/PersistentCollection.php index 4e64acb26..a50cd8343 100644 --- a/lib/Doctrine/ORM/PersistentCollection.php +++ b/lib/Doctrine/ORM/PersistentCollection.php @@ -521,10 +521,8 @@ final class PersistentCollection implements Collection, Selectable && $this->association['fetch'] === Mapping\ClassMetadataInfo::FETCH_EXTRA_LAZY && isset($this->association['indexBy']) ) { - $class = $this->em->getClassMetadata($this->association['targetEntity']); - - if (!$class->isIdentifierComposite && $class->isIdentifier($this->association['indexBy'])) { - return $this->em->find($class->name, $key); + if (!$this->typeClass->isIdentifierComposite && $this->typeClass->isIdentifier($this->association['indexBy'])) { + return $this->em->find($this->typeClass->name, $key); } return $this->em->getUnitOfWork()->getCollectionPersister($this->association)->get($this, $key);