mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 11:03:50 +00:00
FIX [filter][missionType] reimplement mission type task filter
This commit is contained in:
@@ -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);
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user