Handle case when some arguments are null in SingleTaskAclAwareRepository

This commit is contained in:
Julien Fastré 2023-07-14 10:13:57 +02:00
parent 8f39d0320c
commit b05e128b5e
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -58,12 +58,12 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository
$qb
->from(SingleTask::class, 't');
if (!empty($pattern)) {
if (null !== $pattern && '' !== $pattern) {
$qb->andWhere($qb->expr()->like('LOWER(UNACCENT(t.title))', 'LOWER(UNACCENT(:pattern))'))
->setParameter('pattern', '%' . $pattern . '%');
}
if (count($users) > 0) {
if (null !== $users && count($users) > 0) {
$orXUser = $qb->expr()->orX();
foreach ($users as $key => $user) {
@ -81,7 +81,7 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository
return $qb;
}
if (count($flags) > 0) {
if (null !== $flags && count($flags) > 0) {
$orXDate = $qb->expr()->orX();
$orXState = $qb->expr()->orX();
$now = new DateTime();