vendee filters and aggregators moved to root folder

This commit is contained in:
2022-08-09 16:46:29 +02:00
parent 97ec921a0a
commit 2c7a128348
4 changed files with 0 additions and 241 deletions

View File

@@ -1,90 +0,0 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Export\Aggregator\PersonAggregators;
use App\Repository\VendeePerson\SituationProfessionelleRepository;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
// todo FIX ERROR AND MOVE TO VENDEE ROOT FOLDER
final class ProfessionalSituationAggregator implements AggregatorInterface
{
private SituationProfessionelleRepository $professionalSituationRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(SituationProfessionelleRepository $professionalSituationRepository, TranslatableStringHelper $translatableStringHelper)
{
$this->professionalSituationRepository = $professionalSituationRepository;
$this->translatableStringHelper = $translatableStringHelper;
}
public function addRole()
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->resetDQLPart('from');
$qb->from('App:VendeePerson', 'vp');
$qb->join('vp.person', 'person');
$qb->join('person.center', 'center');
$qb->join('vp.situationProfessionelle', 'sp');
$qb->addSelect('sp.id as professional_situation_aggregator');
$groupBy = $qb->getDQLPart('groupBy');
if (!empty($groupBy)) {
$qb->addGroupBy('professional_situation_aggregator');
} else {
$qb->groupBy('professional_situation_aggregator');
}
}
public function applyOn()
{
return Declarations::PERSON_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
{
}
public function getLabels($key, array $values, $data)
{
return function ($value): string {
if ('_header' === $value) {
return 'Professional situation';
}
$g = $this->professionalSituationRepository->find($value);
return $this->translatableStringHelper->localize($g->getName());;
};
}
public function getQueryKeys($data)
{
return ['professional_situation_aggregator'];
}
public function getTitle()
{
return 'Group people by their professional situation';
}
}