1
0
mirror of synced 2024-12-05 03:06:05 +03:00

#1159 - Doctrine\ORM\Repository\DefaultRepositoryFactory keeps separate caches per entity manager used to build repositories

This commit is contained in:
Marco Pivetta 2014-10-14 01:46:14 +02:00
parent 56378b9bf0
commit a9847533e5

View File

@ -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);
}
/**