renaming aggregator job and scope for generic use

This commit is contained in:
Julie Lenaerts 2022-08-02 11:30:30 +02:00
parent 28dc99ff3f
commit 40d92d11fc
3 changed files with 16 additions and 16 deletions

View File

@ -18,7 +18,7 @@ use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
final class ReferrerJobAggregator implements AggregatorInterface
final class JobAggregator implements AggregatorInterface
{
private UserJobRepository $userJobRepository;
@ -38,14 +38,14 @@ final class ReferrerJobAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acpw.referrers', 'r');
$qb->addSelect('IDENTITY(r.userJob) as referrer_job_aggregator');
$qb->addSelect('IDENTITY(r.userJob) as job_aggregator');
$groupBy = $qb->getDQLPart('groupBy');
if (!empty($groupBy)) {
$qb->addGroupBy('referrer_job_aggregator');
$qb->addGroupBy('job_aggregator');
} else {
$qb->groupBy('referrer_job_aggregator');
$qb->groupBy('job_aggregator');
}
}
@ -76,7 +76,7 @@ final class ReferrerJobAggregator implements AggregatorInterface
public function getQueryKeys($data)
{
return ['referrer_job_aggregator'];
return ['job_aggregator'];
}
public function getTitle()

View File

@ -18,7 +18,7 @@ use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
final class ReferrerScopeAggregator implements AggregatorInterface
final class ScopeAggregator implements AggregatorInterface
{
private ScopeRepository $scopeRepository;
@ -38,14 +38,14 @@ final class ReferrerScopeAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acpw.referrers', 'r');
$qb->addSelect('IDENTITY(r.mainScope) as referrer_scope_aggregator');
$qb->addSelect('IDENTITY(r.mainScope) as scope_aggregator');
$groupBy = $qb->getDQLPart('groupBy');
if (!empty($groupBy)) {
$qb->addGroupBy('referrer_scope_aggregator');
$qb->addGroupBy('scope_aggregator');
} else {
$qb->groupBy('referrer_scope_aggregator');
$qb->groupBy('scope_aggregator');
}
}
@ -76,7 +76,7 @@ final class ReferrerScopeAggregator implements AggregatorInterface
public function getQueryKeys($data)
{
return ['referrer_scope_aggregator'];
return ['scope_aggregator'];
}
public function getTitle()

View File

@ -44,19 +44,19 @@ services:
tags:
- { name: chill.export_aggregator, alias: social_work_actions_referrer_aggregator }
chill.person.export.aggregator_referrer_job:
class: Chill\PersonBundle\Export\Aggregator\ReferrerJobAggregator
chill.person.export.aggregator_job:
class: Chill\PersonBundle\Export\Aggregator\JobAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: social_work_actions_referrer_job_aggregator }
- { name: chill.export_aggregator, alias: social_work_actions_job_aggregator }
chill.person.export.aggregator_referrer_scope:
class: Chill\PersonBundle\Export\Aggregator\ReferrerScopeAggregator
chill.person.export.aggregator_scope:
class: Chill\PersonBundle\Export\Aggregator\ScopeAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: social_work_actions_referrer_scope_aggregator }
- { name: chill.export_aggregator, alias: social_work_actions_scope_aggregator }
chill.person.export.aggregator_action_type:
class: Chill\PersonBundle\Export\Aggregator\ActionTypeAggregator