mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
[person][export] Fixed: rename the alias for accompanying_period
to acp
in filter associated with person
This commit is contained in:
parent
35a2d08267
commit
59b22dbb6d
@ -11,6 +11,7 @@ and this project adheres to
|
||||
## Unreleased
|
||||
|
||||
<!-- write down unreleased development here -->
|
||||
* [person][export] Fixed: rename the alias for `accompanying_period` to `acp` in filter associated with person
|
||||
|
||||
## Test releases
|
||||
|
||||
|
@ -25,13 +25,17 @@ class AbstractAccompanyingPeriodExportElement
|
||||
*/
|
||||
protected function addJoinAccompanyingPeriod(QueryBuilder $query): void
|
||||
{
|
||||
if (false === $this->havingAccompanyingPeriodInJoin($query)) {
|
||||
if (false === in_array('person', $query->getAllAliases(), true)) {
|
||||
throw new LogicException("the alias 'person' does not exists in "
|
||||
. 'query builder');
|
||||
}
|
||||
|
||||
$query->join('person.accompanyingPeriods', 'accompanying_period');
|
||||
if (!in_array('acppart', $query->getAllAliases(), true)) {
|
||||
$query->join('person.accompanyingPeriodParticipations', 'acppart');
|
||||
}
|
||||
|
||||
if (!in_array('acp', $query->getAllAliases(), true)) {
|
||||
$query->join('acppart.accompanyingPeriod', 'acp');
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,8 +44,6 @@ class AbstractAccompanyingPeriodExportElement
|
||||
*/
|
||||
protected function havingAccompanyingPeriodInJoin(QueryBuilder $query): bool
|
||||
{
|
||||
$joins = $query->getDQLPart('join') ?? [];
|
||||
|
||||
return in_array('accompanying_period', $query->getAllAliases(), true);
|
||||
return in_array('acp', $query->getAllAliases(), true);
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ class AccompanyingPeriodClosingFilter extends AbstractAccompanyingPeriodExportEl
|
||||
$this->addJoinAccompanyingPeriod($qb);
|
||||
|
||||
$clause = $qb->expr()->andX(
|
||||
$qb->expr()->lte('accompanying_period.closingDate', ':date_to'),
|
||||
$qb->expr()->gte('accompanying_period.closingDate', ':date_from')
|
||||
$qb->expr()->lte('acp.closingDate', ':date_to'),
|
||||
$qb->expr()->gte('acp.closingDate', ':date_from')
|
||||
);
|
||||
|
||||
$qb->andWhere($clause);
|
||||
|
@ -34,12 +34,12 @@ class AccompanyingPeriodFilter extends AbstractAccompanyingPeriodExportElement i
|
||||
$clause = $qb->expr()->andX();
|
||||
|
||||
$clause->add(
|
||||
$qb->expr()->lte('accompanying_period.openingDate', ':date_to')
|
||||
$qb->expr()->lte('acp.openingDate', ':date_to')
|
||||
);
|
||||
$clause->add(
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->gte('accompanying_period.closingDate', ':date_from'),
|
||||
$qb->expr()->isNull('accompanying_period.closingDate')
|
||||
$qb->expr()->gte('acp.closingDate', ':date_from'),
|
||||
$qb->expr()->isNull('acp.closingDate')
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -32,8 +32,8 @@ class AccompanyingPeriodOpeningFilter extends AbstractAccompanyingPeriodExportEl
|
||||
$this->addJoinAccompanyingPeriod($qb);
|
||||
|
||||
$clause = $qb->expr()->andX(
|
||||
$qb->expr()->lte('accompanying_period.openingDate', ':date_to'),
|
||||
$qb->expr()->gte('accompanying_period.openingDate', ':date_from')
|
||||
$qb->expr()->lte('acp.openingDate', ':date_to'),
|
||||
$qb->expr()->gte('acp.openingDate', ':date_from')
|
||||
);
|
||||
|
||||
$qb->andWhere($clause);
|
||||
|
Loading…
x
Reference in New Issue
Block a user