From a9847533e5d3c2efc15284fb93fb57a443978cf5 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Tue, 14 Oct 2014 01:46:14 +0200 Subject: [PATCH] #1159 - `Doctrine\ORM\Repository\DefaultRepositoryFactory` keeps separate caches per entity manager used to build repositories --- lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php b/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php index b9afbfabf..16751c705 100644 --- a/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php +++ b/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php @@ -41,13 +41,13 @@ class DefaultRepositoryFactory implements RepositoryFactory */ public function getRepository(EntityManagerInterface $entityManager, $entityName) { - $className = $entityManager->getClassMetadata($entityName)->getName(); + $repositoryHash = $entityManager->getClassMetadata($entityName)->getName() . spl_object_hash($entityManager); - if (isset($this->repositoryList[$className])) { - return $this->repositoryList[$className]; + if (isset($this->repositoryList[$repositoryHash])) { + return $this->repositoryList[$repositoryHash]; } - return $this->repositoryList[$className] = $this->createRepository($entityManager, $entityName); + return $this->repositoryList[$repositoryHash] = $this->createRepository($entityManager, $entityName); } /**