Skip to content

Commit 981463f

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

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+
$qb = $this->getEntityManager()->createQueryBuilder();
134+
135+
$qb->select('DISTINCT u', 'g')
136+
->from(User::class, 'u')
137+
->leftJoin('u.groups', 'g')
138+
->where('u.id = :id')
139+
->setParameter('id', $id);
140+
141+
return $qb->getQuery()->getOneOrNullResult();
137142
}
138143
}

0 commit comments

Comments
 (0)