FIX [filter][missionType] reimplement mission type task filter

This commit is contained in:
2023-08-21 11:24:33 +02:00
parent 01e9a15bd7
commit bc4af576bc
3 changed files with 30 additions and 4 deletions

View File

@@ -52,6 +52,7 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository
public function buildBaseQuery(
?string $pattern = null,
?array $flags = [],
?array $types = [],
?array $users = []
): QueryBuilder {
$qb = $this->em->createQueryBuilder();
@@ -81,6 +82,12 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository
return $qb;
}
if (null !== $types && count($types) > 0) {
$qb->andWhere($qb->expr()->in('t.type', ':types'));
$qb->setParameter('types', $types);
}
if (null !== $flags && count($flags) > 0) {
$orXDate = $qb->expr()->orX();
$orXState = $qb->expr()->orX();
@@ -203,9 +210,10 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository
public function countByAllViewable(
?string $pattern = null,
?array $flags = [],
?array $types = [],
?array $users = []
): int {
$qb = $this->buildBaseQuery($pattern, $flags, $users);
$qb = $this->buildBaseQuery($pattern, $flags, $types, $users);
return $this
->addACLGlobal($qb)
@@ -251,12 +259,13 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository
public function findByAllViewable(
?string $pattern = null,
?array $flags = [],
?array $types = [],
?array $users = [],
?int $start = 0,
?int $limit = 50,
?array $orderBy = []
): array {
$qb = $this->buildBaseQuery($pattern, $flags, $users);
$qb = $this->buildBaseQuery($pattern, $flags, $types, $users);
$qb = $this->addACLGlobal($qb);
return $this->getResult($qb, $start, $limit, $orderBy);

View File

@@ -19,6 +19,7 @@ interface SingleTaskAclAwareRepositoryInterface
public function countByAllViewable(
?string $pattern = null,
?array $flags = [],
?array $types = [],
?array $users = []
): int;
@@ -39,6 +40,7 @@ interface SingleTaskAclAwareRepositoryInterface
public function findByAllViewable(
?string $pattern = null,
?array $flags = [],
?array $types = [],
?array $users = [],
?int $start = 0,
?int $limit = 50,