Skip to content

Commit

Permalink
doctrine#1159 - Doctrine\ORM\Repository\DefaultRepositoryFactory ke…
Browse files Browse the repository at this point in the history
…eps separate caches per entity manager used to build repositories
  • Loading branch information
Ocramius committed Oct 13, 2014
1 parent 56378b9 commit a984753
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit a984753

Please sign in to comment.