mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
exports: test if a join is already loaded
when a specific join has to be shared between combined filters/aggregators, we need to check if it has been already loaded. we cannot load it into indicator because result is wrong
This commit is contained in:
parent
18c17818f6
commit
70488a935d
@ -76,6 +76,10 @@ class ChildrenNumberAggregator implements AggregatorInterface
|
||||
*/
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('composition', $qb->getAllAliases())) {
|
||||
$qb->join('household.compositions', 'composition');
|
||||
}
|
||||
|
||||
$qb->addSelect('composition.numberOfChildren AS childrennumber_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
@ -83,6 +83,10 @@ class CompositionAggregator implements AggregatorInterface
|
||||
*/
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('composition', $qb->getAllAliases())) {
|
||||
$qb->join('household.compositions', 'composition');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(composition.householdCompositionType) AS composition_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
@ -107,7 +107,6 @@ class CountHousehold implements ExportInterface, GroupedExportInterface
|
||||
->join('acppart.person', 'person')
|
||||
->join('person.householdParticipations', 'householdmember')
|
||||
->join('householdmember.household', 'household')
|
||||
->join('household.compositions', 'composition')
|
||||
;
|
||||
|
||||
$qb->select('COUNT(DISTINCT householdmember.household) AS export_result');
|
||||
|
@ -85,6 +85,10 @@ class CompositionFilter implements FilterInterface
|
||||
*/
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('composition', $qb->getAllAliases())) {
|
||||
$qb->join('household.compositions', 'composition');
|
||||
}
|
||||
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
$clause = $qb->expr()->andX(
|
||||
|
Loading…
x
Reference in New Issue
Block a user