Fixed getLast4Notes method

This commit is contained in:
Ryan Prather 2024-05-16 21:01:57 -04:00
parent 06cbc286a6
commit b817ac7e23

View File

@ -19,13 +19,17 @@ class NoteRepository extends ServiceEntityRepository
public function getLast4Notes(?User $user): array public function getLast4Notes(?User $user): array
{ {
if (!$user) {
return [];
}
$ret = $this->createQueryBuilder('n') $ret = $this->createQueryBuilder('n')
->where('n.user = :user') ->where('n.user = :user')
->setParameter('user', (string) $user->getId()) ->setParameter('user', $user->getId()->toBinary())
->orderBy('n.date', 'DESC') ->orderBy('n.date', 'DESC')
->setMaxResults(4) ->setMaxResults(4)
->getQuery() ->getQuery()
->getResult(); ->getResult();
return $ret; return $ret;
} }