Skip to content

Commit a8e26e7

Browse files
committed
chore: fix typo on user repo
1 parent 867ca27 commit a8e26e7

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

app/Repositories/DoctrineUserRepository.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,16 @@ public function getByVerificationEmailToken(string $token): ?User
128128
]);
129129
}
130130

131-
public function getByIdWithGroups(int $id): ?User {
132-
return $this->_em->createQuery(
133-
'SELECT u, g FROM ' .User::class . ' u
134-
LEFT JOIN FETCH u.groups g
135-
WHERE u.id = :id'
136-
)->setParameter('id', $id)->getOneOrNullResult();
131+
public function getByIdWithGroups(int $id): ?User
132+
{
133+
$dql = 'SELECT DISTINCT u
134+
FROM ' . User::class . ' u
135+
LEFT JOIN FETCH u.groups g
136+
WHERE u.id = :id';
137+
138+
return $this->getEntityManager()
139+
->createQuery($dql)
140+
->setParameter('id', $id)
141+
->getOneOrNullResult();
137142
}
138143
}

0 commit comments

Comments
 (0)