renaming aggregator job and scope for generic use

This commit is contained in:
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()