mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-04 22:04:59 +00:00
exports: add condition with distinct alias on join clauses (wip)
This commit is contained in:
@@ -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');
|
||||
|
||||
|
@@ -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');
|
||||
|
||||
|
@@ -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');
|
||||
|
||||
|
@@ -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');
|
||||
|
||||
|
@@ -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');
|
||||
|
||||
|
@@ -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');
|
||||
|
||||
|
@@ -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 )
|
||||
|
@@ -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');
|
||||
|
||||
|
@@ -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');
|
||||
|
||||
|
@@ -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');
|
||||
|
||||
|
Reference in New Issue
Block a user