22
22
final class TestRepositoryFactory implements RepositoryFactory
23
23
{
24
24
/**
25
- * The list of EntityRepository instances.
26
- *
27
25
* @var ObjectRepository[]
28
26
*/
29
27
private $ repositoryList = array ();
@@ -42,11 +40,6 @@ public function getRepository(EntityManagerInterface $entityManager, $entityName
42
40
return $ this ->repositoryList [$ repositoryHash ] = $ this ->createRepository ($ entityManager , $ entityName );
43
41
}
44
42
45
- /**
46
- * @param EntityManagerInterface $entityManager
47
- * @param string $entityName
48
- * @param ObjectRepository $repository
49
- */
50
43
public function setRepository (EntityManagerInterface $ entityManager , $ entityName , ObjectRepository $ repository )
51
44
{
52
45
$ repositoryHash = $ this ->getRepositoryHash ($ entityManager , $ entityName );
@@ -55,29 +48,17 @@ public function setRepository(EntityManagerInterface $entityManager, $entityName
55
48
}
56
49
57
50
/**
58
- * Create a new repository instance for an entity class.
59
- *
60
- * @param EntityManagerInterface $entityManager The EntityManager instance.
61
- * @param string $entityName The name of the entity.
62
- *
63
51
* @return ObjectRepository
64
52
*/
65
53
private function createRepository (EntityManagerInterface $ entityManager , $ entityName )
66
54
{
67
55
/* @var $metadata ClassMetadata */
68
56
$ metadata = $ entityManager ->getClassMetadata ($ entityName );
69
- $ repositoryClassName = $ metadata ->customRepositoryClassName
70
- ?: $ entityManager ->getConfiguration ()->getDefaultRepositoryClassName ();
57
+ $ repositoryClassName = $ metadata ->customRepositoryClassName ?: $ entityManager ->getConfiguration ()->getDefaultRepositoryClassName ();
71
58
72
59
return new $ repositoryClassName ($ entityManager , $ metadata );
73
60
}
74
61
75
- /**
76
- * @param EntityManagerInterface $entityManager
77
- * @param string $entityName
78
- *
79
- * @return string
80
- */
81
62
private function getRepositoryHash (EntityManagerInterface $ entityManager , $ entityName )
82
63
{
83
64
return $ entityManager ->getClassMetadata ($ entityName )->getName ().spl_object_hash ($ entityManager );
0 commit comments