household list of accompanying periods + upgrade DBAL version to 3.1

This commit is contained in:
2021-11-08 10:57:14 +00:00
committed by Julien Fastré
parent 092ea4d57f
commit 7fabe0214e
49 changed files with 353 additions and 286 deletions

View File

@@ -8,7 +8,7 @@ use Doctrine\ORM\QueryBuilder;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Symfony\Component\Security\Core\Role\Role;
use Chill\TaskBundle\Security\Authorization\TaskVoter;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
use Chill\MainBundle\Entity\Center;
/**
@@ -120,13 +120,13 @@ class SingleTaskRepository extends EntityRepository
throw new \UnexpectedValueException("params 'center' should be an instance of ".Center::class);
}
}
if (\array_key_exists('unassigned', $params) and $params['unassigned'] === true) {
if (\array_key_exists('user', $params) and !empty($params['user'])) {
throw new \UnexpectedValueException("You should not require for "
. "unassigned tasks and tasks assigned to some user.");
}
$qb->andWhere($qb->expr()->isNull('st.assignee'));
}
@@ -139,7 +139,7 @@ class SingleTaskRepository extends EntityRepository
$qb->andWhere($qb->expr()->eq('st.circle', ':scope'));
$qb->setParameter('scope', $params['scope']);
}
if (\array_key_exists('types', $params) && $params['types'] !== NULL) {
if (count($params['types']) > 0) {
$qb->andWhere($qb->expr()->in('st.type', ':types'));
@@ -154,7 +154,7 @@ class SingleTaskRepository extends EntityRepository
if (\array_key_exists('is_closed', $params)) {
$qb->andWhere($this->buildIsClosed($qb, !$params['is_closed']));
}
}
protected function addTypeFilter(QueryBuilder $qb, $params)
@@ -191,7 +191,7 @@ class SingleTaskRepository extends EntityRepository
->add($this->buildNowIsAfterStartDate($qb, true))
;
}
$qb->setParameter('now', new \DateTime('today'), Type::DATE);
$qb->setParameter('now', new \DateTime('today'), Types::DATE_MUTABLE);
$qb->andWhere($andWhere);
}