mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
exports: add a new GeographicalUnitStat aggregator
This commit is contained in:
parent
eedfa60bea
commit
29cc589bf2
@ -0,0 +1,96 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Export\AggregatorInterface;
|
||||||
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
|
final class GeographicalUnitStatAggregator implements AggregatorInterface
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
private EntityRepository $repository;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
EntityManagerInterface $em
|
||||||
|
) {
|
||||||
|
$this->repository = $em->getRepository(...::class);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getLabels($key, array $values, $data)
|
||||||
|
{
|
||||||
|
return function ($value): string {
|
||||||
|
if ('_header' === $value) {
|
||||||
|
return 'Geographical unit';
|
||||||
|
}
|
||||||
|
|
||||||
|
$g = $this->repository->find($value);
|
||||||
|
|
||||||
|
return $g; //...
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getQueryKeys($data): array
|
||||||
|
{
|
||||||
|
return ['geographicalunitstat_aggregator'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
{
|
||||||
|
// TODO: Implement buildForm() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getTitle(): string
|
||||||
|
{
|
||||||
|
return 'Group by geographical unit';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function addRole()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
|
{
|
||||||
|
|
||||||
|
//$qb->addSelect('... AS geographicalunitstat_aggregator');
|
||||||
|
|
||||||
|
$groupby = $qb->getDQLPart('groupBy');
|
||||||
|
|
||||||
|
if (!empty($groupBy)) {
|
||||||
|
$qb->addGroupBy('geographicalunitstat_aggregator');
|
||||||
|
} else {
|
||||||
|
$qb->groupBy('geographicalunitstat_aggregator');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function applyOn(): string
|
||||||
|
{
|
||||||
|
return Declarations::ACP_TYPE;
|
||||||
|
}
|
||||||
|
}
|
@ -178,6 +178,13 @@ services:
|
|||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: accompanyingcourse_step_aggregator }
|
- { name: chill.export_aggregator, alias: accompanyingcourse_step_aggregator }
|
||||||
|
|
||||||
|
chill.person.export.aggregator_geographicalunitstat:
|
||||||
|
class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\GeographicalUnitStatAggregator
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
tags:
|
||||||
|
- { name: chill.export_aggregator, alias: accompanyingcourse_geographicalunitstat_aggregator }
|
||||||
|
|
||||||
chill.person.export.aggregator_socialaction:
|
chill.person.export.aggregator_socialaction:
|
||||||
class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\SocialActionAggregator
|
class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\SocialActionAggregator
|
||||||
autowire: true
|
autowire: true
|
||||||
|
@ -449,6 +449,8 @@ Step: Statut
|
|||||||
Group by step: Grouper les parcours par statut du parcours
|
Group by step: Grouper les parcours par statut du parcours
|
||||||
|
|
||||||
Filter by geographical unit: Filtrer les parcours par zone géographique
|
Filter by geographical unit: Filtrer les parcours par zone géographique
|
||||||
|
Group by geographical unit: Grouper les parcours par zone géographique
|
||||||
|
Geographical unit: Zone géographique
|
||||||
|
|
||||||
Filter by socialaction: Filtrer les parcours par action d'accompagnement
|
Filter by socialaction: Filtrer les parcours par action d'accompagnement
|
||||||
Accepted socialactions: Actions d'accompagnement
|
Accepted socialactions: Actions d'accompagnement
|
||||||
|
Loading…
x
Reference in New Issue
Block a user