Fixed getLast4Notes method
This commit is contained in:
parent
06cbc286a6
commit
b817ac7e23
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user