diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php index d318d969a..f31e2e73f 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php @@ -44,8 +44,8 @@ class ActivityTypeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('type', $qb->getAllAliases(), true)) { - $qb->join('activity.activityType', 'type'); + if (!in_array('aty', $qb->getAllAliases(), true)) { + $qb->join('activity.activityType', 'aty'); } $qb->addSelect(sprintf('IDENTITY(activity.activityType) AS %s', self::KEY)); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php index a1cf7160b..13185c2a2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php @@ -39,7 +39,9 @@ class AdministrativeLocationAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acp.administrativeLocation', 'al'); + if (!in_array('acploc', $qb->getAllAliases(), true)) { + $qb->join('acp.administrativeLocation', 'acploc'); + } $qb->addSelect('IDENTITY(acp.administrativeLocation) AS location_aggregator'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php index b0f8f98f0..033ba4365 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php @@ -40,7 +40,9 @@ class ClosingMotiveAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acp.closingMotive', 'cm'); + if (!in_array('acpmotive', $qb->getAllAliases(), true)) { + $qb->join('acp.closingMotive', 'acpmotive'); + } $qb->addSelect('IDENTITY(acp.closingMotive) AS closingmotive_aggregator'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php index 96c63b9cf..120506aae 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php @@ -43,9 +43,12 @@ final class EvaluationAggregator implements AggregatorInterface if (!in_array('acpw', $qb->getAllAliases(), true)) { $qb->join('acp.works', 'acpw'); } - $qb->join('acpw.accompanyingPeriodWorkEvaluations', 'we'); - $qb->addSelect('IDENTITY(we.evaluation) AS evaluation_aggregator'); + if (!in_array('workeval', $qb->getAllAliases(), true)) { + $qb->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval'); + } + + $qb->addSelect('IDENTITY(workeval.evaluation) AS evaluation_aggregator'); $groupby = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php index 6443cc02e..7634ea37f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php @@ -39,7 +39,9 @@ final class JobAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acp.job', 'j'); + if (!in_array('acpjob', $qb->getAllAliases(), true)) { + $qb->join('acp.job', 'acpjob'); + } $qb->addSelect('IDENTITY(acp.job) AS job_aggregator'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php index b98edae32..4c784e08d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php @@ -41,7 +41,9 @@ final class OriginAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acp.origin', 'o'); + if (!in_array('acporigin', $qb->getAllAliases(), true)) { + $qb->join('acp.origin', 'acporigin'); + } $qb->addSelect('o.id AS origin_aggregator'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php index a1df6b559..22eca6f76 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php @@ -39,9 +39,11 @@ final class ReferrerAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acp.user', 'u'); + if (!in_array('acpuser', $qb->getAllAliases(), true)) { + $qb->join('acp.user', 'acpuser'); + } - $qb->addSelect('u.id AS referrer_aggregator'); + $qb->addSelect('acpuser.id AS referrer_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php index 26d5fad53..80195bdcc 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php @@ -35,8 +35,8 @@ final class RequestorAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('part', $qb->getAllAliases(), true)) { - $qb->join('acp.participations', 'part'); + if (!in_array('acppart', $qb->getAllAliases(), true)) { + $qb->join('acp.participations', 'acppart'); } $qb->addSelect(" @@ -44,7 +44,7 @@ final class RequestorAggregator implements AggregatorInterface WHEN acp.requestorPerson IS NOT NULL THEN ( CASE - WHEN acp.requestorPerson = part.person + WHEN acp.requestorPerson = acppart.person THEN 'is person concerned' ELSE 'is other person' END ) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php index c7b3142f2..5b2901921 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php @@ -39,9 +39,11 @@ final class ScopeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acp.scopes', 's'); + if (!in_array('acpscope', $qb->getAllAliases(), true)) { + $qb->join('acp.scopes', 'acpscope'); + } - $qb->addSelect('s.id as scope_aggregator'); + $qb->addSelect('acpscope.id as scope_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php index 7cb726673..ac5ac94c0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php @@ -39,8 +39,11 @@ final class SocialIssueAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acp.socialIssues', 'si'); - $qb->addSelect('si.id as socialissue_aggregator'); + if (!in_array('acpsocialissue', $qb->getAllAliases(), true)) { + $qb->join('acp.socialIssues', 'acpsocialissue'); + } + + $qb->addSelect('acpsocialissue.id as socialissue_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php index ea94e891b..b63d3842f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php @@ -46,22 +46,27 @@ final class HouseholdPositionAggregator implements AggregatorInterface, ExportEl public function alterQuery(QueryBuilder $qb, $data) { $qb->resetDQLPart('from'); - $qb->from(HouseholdMember::class, 'hm'); + $qb->from(HouseholdMember::class, 'member'); - $qb->join('hm.person', 'person'); - $qb->join('person.center', 'center'); + if (!in_array('person', $qb->getAllAliases(), true)) { + $qb->join('member.person', 'person'); + } + + if (!in_array('center', $qb->getAllAliases(), true)) { + $qb->join('person.center', 'center'); + } $qb->andWhere($qb->expr()->andX( - $qb->expr()->lte('hm.startDate', ':date'), + $qb->expr()->lte('member.startDate', ':date'), $qb->expr()->orX( - $qb->expr()->isNull('hm.endDate'), - $qb->expr()->gte('hm.endDate', ':date') + $qb->expr()->isNull('member.endDate'), + $qb->expr()->gte('member.endDate', ':date') ) )); $qb->setParameter('date', $data['date_position']); - $qb->addSelect('IDENTITY(hm.position) AS household_position_aggregator'); + $qb->addSelect('IDENTITY(member.position) AS household_position_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php index e931a1a42..5b2ab65eb 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php @@ -88,11 +88,17 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - $qb = $this->repository->createQueryBuilder('acp') - ->join('acp.works', 'acpw') - ->join('acpw.accompanyingPeriodWorkEvaluations', 'eval'); + $qb = $this->repository->createQueryBuilder('acp'); - $qb->select('COUNT(eval.id) AS export_result'); + if (!in_array('acpw', $qb->getAllAliases(), true)) { + $qb->join('acp.works', 'acpw'); + } + + if (!in_array('workeval', $qb->getAllAliases(), true)) { + $qb->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval'); + } + + $qb->select('COUNT(workeval.id) AS export_result'); return $qb; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php index a79c1c00e..f60f66310 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php @@ -88,13 +88,26 @@ class CountHousehold implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - $qb = $this->repository->createQueryBuilder('acp') - ->join('acp.participations', 'acppart') - ->join('acppart.person', 'person') - ->join('person.householdParticipations', 'householdmember') - ->join('householdmember.household', 'household'); + $qb = $this->repository->createQueryBuilder('acp'); - $qb->select('COUNT(DISTINCT householdmember.household) AS export_result'); + if (!in_array('acppart', $qb->getAllAliases(), true)) { + $qb->join('acp.participations', 'acppart'); + } + + if (!in_array('partperson', $qb->getAllAliases(), true)) { + $qb->join('acppart.person', 'partperson'); + } + + if (!in_array('member', $qb->getAllAliases(), true)) { + $qb->join('partperson.householdParticipations', 'member'); + } + + if (!in_array('household', $qb->getAllAliases(), true)) { + $qb->join('member.household', 'household'); + } + + + $qb->select('COUNT(DISTINCT member.household) AS export_result'); return $qb; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php index 4de0eb191..800023fc5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php @@ -88,11 +88,17 @@ class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExpor public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - $qb = $this->repository->createQueryBuilder('acp') - ->join('acp.participations', 'acppart') - ->join('acppart.person', 'person'); + $qb = $this->repository->createQueryBuilder('acp'); - $qb->select('COUNT(DISTINCT person.id) AS export_result'); + if (!in_array('acppart', $qb->getAllAliases(), true)) { + $qb->join('acp.participations', 'acppart'); + } + + if (!in_array('partperson', $qb->getAllAliases(), true)) { + $qb->join('acppart.person', 'partperson'); + } + + $qb->select('COUNT(DISTINCT partperson.id) AS export_result'); return $qb; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php index 1a856e23d..17de7e5ae 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php @@ -90,8 +90,11 @@ class CountSocialWorkActions implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder { - $qb = $this->repository->createQueryBuilder('acp') - ->join('acp.works', 'acpw'); + $qb = $this->repository->createQueryBuilder('acp'); + + if (!in_array('acpw', $qb->getAllAliases(), true)) { + $qb->join('acp.works', 'acpw'); + } $qb->select('COUNT(acpw.id) as export_result'); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php index 845b318b9..2659172a4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php @@ -43,11 +43,11 @@ class ActivityTypeFilter implements FilterInterface // we replace indicator 'from' clause by 'act', and put 'acp' in a join $qb->resetDQLPart('from'); - $qb->from('ChillActivityBundle:Activity', 'act'); + $qb->from('ChillActivityBundle:Activity', 'activity'); $qb - ->join('act.accompanyingPeriod', 'acp') - ->join('act.activityType', 'aty'); + ->join('activity.accompanyingPeriod', 'acp') + ->join('activity.activityType', 'aty'); $where = $qb->getDQLPart('where'); $clause = $qb->expr()->in('aty.id', ':activitytypes'); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php index cbbd9bef5..569146614 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php @@ -42,10 +42,12 @@ class CurrentUserScopeFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acp.scopes', 's'); + if (!in_array('acpscope', $qb->getAllAliases(), true)) { + $qb->join('acp.scopes', 'acpscope'); + } $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->eq('s.id', ':userscope'); + $clause = $qb->expr()->eq('acpscope.id', ':userscope'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php index 7df43a06f..c04d5bcd0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php @@ -37,13 +37,20 @@ class EvaluationFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb - ->join('acp.works', 'acpw') - ->join('acpw.accompanyingPeriodWorkEvaluations', 'we') - ->join('we.evaluation', 'ev'); + if (!in_array('acpw', $qb->getAllAliases(), true)) { + $qb->join('acp.works', 'acpw'); + } + + if (!in_array('workeval', $qb->getAllAliases(), true)) { + $qb->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval'); + } + + if (!in_array('eval', $qb->getAllAliases(), true)) { + $qb->join('workeval.evaluation', 'eval'); + } $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('ev.id', ':evaluations'); + $clause = $qb->expr()->in('eval.id', ':evaluations'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php index 6bcf359ae..c0338b42e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php @@ -55,11 +55,14 @@ final class RequestorFilter implements FilterInterface switch ($data['accepted_choices']) { case 'participation': - $qb->join('acp.participations', 'part'); + + if (!in_array('acppart', $qb->getAllAliases(), true)) { + $qb->join('acp.participations', 'acppart'); + } $clause = $qb->expr()->andX( $qb->expr()->isNotNull('acp.requestorPerson'), - $qb->expr()->eq('acp.requestorPerson', 'part.person') + $qb->expr()->eq('acp.requestorPerson', 'acppart.person') ); break; @@ -67,7 +70,9 @@ final class RequestorFilter implements FilterInterface case 'other_person': $expr = $this->em->getExpressionBuilder(); - $qb->join('acp.participations', 'part'); + if (!in_array('acppart', $qb->getAllAliases(), true)) { + $qb->join('acp.participations', 'acppart'); + } $clause = $expr->andX( $expr->isNotNull('acp.requestorPerson'), @@ -76,10 +81,10 @@ final class RequestorFilter implements FilterInterface // subquery $this->em->createQueryBuilder() - ->select('identity(acp2.requestorPerson)') ->from('ChillPersonBundle:AccompanyingPeriod', 'acp2') - ->join('acp2.participations', 'part2') - ->where($expr->eq('acp2.requestorPerson', 'part2.person')) + ->join('acp2.participations', 'acppart2') + ->select('identity(acp2.requestorPerson)') + ->where($expr->eq('acp2.requestorPerson', 'acppart2.person')) ->getDQL() ) ); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php index 50889225c..c0eb98513 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php @@ -46,7 +46,10 @@ class SocialActionFilter implements FilterInterface if (!in_array('acpw', $qb->getAllAliases(), true)) { $qb->join('acp.works', 'acpw'); } - $qb->join('acpw.socialAction', 'sa'); + + if (!in_array('acpw', $qb->getAllAliases(), true)) { + $qb->join('acpw.socialAction', 'sa'); + } $where = $qb->getDQLPart('where'); $clause = $qb->expr()->in('sa.id', ':socialactions'); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php index fdcb15ee7..ad232d7c2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php @@ -50,10 +50,12 @@ class SocialIssueFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acp.socialIssues', 'si'); + if (!in_array('acpsocialissue', $qb->getAllAliases(), true)) { + $qb->join('acp.socialIssues', 'acpsocialissue'); + } $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('si.id', ':socialissues'); + $clause = $qb->expr()->in('acpsocialissue.id', ':socialissues'); if ($where instanceof Andx) { $where->add($clause);