@@ -28,12 +28,7 @@ class UserManager extends BaseUserManager
2828 /**
2929 * @var string
3030 */
31- protected $ class ;
32-
33- /**
34- * @var ObjectRepository
35- */
36- protected $ repository ;
31+ private $ class ;
3732
3833 /**
3934 * Constructor.
@@ -48,10 +43,15 @@ public function __construct(PasswordUpdaterInterface $passwordUpdater, Canonical
4843 parent ::__construct ($ passwordUpdater , $ canonicalFieldsUpdater );
4944
5045 $ this ->objectManager = $ om ;
51- $ this ->repository = $ om ->getRepository ($ class );
46+ $ this ->class = $ class ;
47+ }
5248
53- $ metadata = $ om ->getClassMetadata ($ class );
54- $ this ->class = $ metadata ->getName ();
49+ /**
50+ * @return ObjectRepository
51+ */
52+ protected function getRepository ()
53+ {
54+ return $ this ->objectManager ->getRepository ($ this ->getClass ());
5555 }
5656
5757 /**
@@ -68,6 +68,11 @@ public function deleteUser(UserInterface $user)
6868 */
6969 public function getClass ()
7070 {
71+ if (false !== strpos ($ this ->class , ': ' )) {
72+ $ metadata = $ this ->objectManager ->getClassMetadata ($ this ->class );
73+ $ this ->class = $ metadata ->getName ();
74+ }
75+
7176 return $ this ->class ;
7277 }
7378
@@ -76,15 +81,15 @@ public function getClass()
7681 */
7782 public function findUserBy (array $ criteria )
7883 {
79- return $ this ->repository ->findOneBy ($ criteria );
84+ return $ this ->getRepository () ->findOneBy ($ criteria );
8085 }
8186
8287 /**
8388 * {@inheritdoc}
8489 */
8590 public function findUsers ()
8691 {
87- return $ this ->repository ->findAll ();
92+ return $ this ->getRepository () ->findAll ();
8893 }
8994
9095 /**
0 commit comments