File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -128,23 +128,24 @@ interface only requires one method: ``loadUserByUsername($username)``::
128128 // src/Repository/UserRepository.php
129129 namespace App\Repository;
130130
131- use Doctrine\ORM\EntityRepository ;
131+ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository ;
132132 use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface;
133133
134- class UserRepository extends EntityRepository implements UserLoaderInterface
134+ class UserRepository extends ServiceEntityRepository implements UserLoaderInterface
135135 {
136136 // ...
137137
138138 public function loadUserByUsername($usernameOrEmail)
139139 {
140- return $this->createQuery(
140+ $entityManager = $this->getEntityManager();
141+
142+ return $entityManager->createQuery(
141143 'SELECT u
142144 FROM App\Entity\User u
143145 WHERE u.username = :query
144146 OR u.email = :query'
145147 )
146148 ->setParameter('query', $usernameOrEmail)
147- ->getQuery()
148149 ->getOneOrNullResult();
149150 }
150151 }
You can’t perform that action at this time.
0 commit comments