From bee5336c1dd3a727902ea006f4ff9a10bba01ee6 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 31 Aug 2022 15:26:28 +0200 Subject: [PATCH 01/18] fix translation with calendar exports --- .../Export/Aggregator/AgentAggregator.php | 2 +- .../Aggregator/CancelReasonAggregator.php | 2 +- .../Export/Aggregator/JobAggregator.php | 2 +- .../Export/Aggregator/LocationAggregator.php | 2 +- .../Aggregator/LocationTypeAggregator.php | 2 +- .../Export/Aggregator/MonthYearAggregator.php | 2 +- .../Export/Aggregator/ScopeAggregator.php | 2 +- .../Export/Filter/AgentFilter.php | 2 +- .../Export/Filter/BetweenDatesFilter.php | 3 ++- .../Export/Filter/JobFilter.php | 2 +- .../Export/Filter/ScopeFilter.php | 2 +- .../translations/messages.fr.yml | 22 +++++++++---------- 12 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php index ed7c265ff..39feb936c 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php @@ -74,6 +74,6 @@ final class AgentAggregator implements AggregatorInterface public function getTitle(): string { - return 'Group by agent'; + return 'Group appointments by agent'; } } \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php index 583153a7d..71e153ef5 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php @@ -50,7 +50,7 @@ class CancelReasonAggregator implements AggregatorInterface public function getTitle(): string { - return 'Group by cancel reason'; + return 'Group appointments by cancel reason'; } public function addRole() diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php index b019cc21b..f2ed06967 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php @@ -50,7 +50,7 @@ final class JobAggregator implements AggregatorInterface public function getTitle(): string { - return 'Group by agent job'; + return 'Group appointments by agent job'; } public function addRole() diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php index bc921c9c7..e1660f110 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php @@ -45,7 +45,7 @@ final class LocationAggregator implements AggregatorInterface public function getTitle(): string { - return 'Group by location'; + return 'Group appointments by location'; } public function addRole(): ?Role diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php index 3b3b9105a..6bfee6c88 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php @@ -50,7 +50,7 @@ final class LocationTypeAggregator implements AggregatorInterface public function getTitle(): string { - return 'Group by location type'; + return 'Group appointments by location type'; } public function addRole() diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php index 71a0e75bb..a135fb2c5 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php @@ -38,7 +38,7 @@ class MonthYearAggregator implements AggregatorInterface public function getTitle(): string { - return 'Group by month and year'; + return 'Group appointments by month and year'; } public function addRole(): ?Role diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php index 3f153f8a5..1cfa06082 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php @@ -50,7 +50,7 @@ final class ScopeAggregator implements AggregatorInterface public function getTitle(): string { - return 'Group by agent scope'; + return 'Group appointments by agent scope'; } public function addRole() diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php index 5c16d0728..b8c607f06 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php @@ -35,7 +35,7 @@ class AgentFilter implements FilterInterface public function getTitle(): string { - return 'Filter by agent'; + return 'Filter appointments by agent'; } public function describeAction($data, $format = 'string'): array diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php index a23c76d98..ff7e61189 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php @@ -5,6 +5,7 @@ namespace Chill\CalendarBundle\Export\Filter; use Chill\CalendarBundle\Export\Declarations; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\ChillDateType; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -26,7 +27,7 @@ class BetweenDatesFilter implements FilterInterface public function getTitle(): string { - return 'Filter by appointments between certain dates'; + return 'Filter appointments between certain dates'; } public function describeAction($data, $format = 'string'): array diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php index 42e03e239..59788e3e4 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php @@ -94,6 +94,6 @@ class JobFilter implements FilterInterface public function getTitle(): string { - return 'Filter by agent job'; + return 'Filter appointments by agent job'; } } diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php index c3fc7b1e4..98bec0991 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php @@ -94,6 +94,6 @@ class ScopeFilter implements FilterInterface public function getTitle() { - return 'Filter by agent scope'; + return 'Filter appointments by agent scope'; } } \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml index 11937d2b7..5ce73afbb 100644 --- a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml @@ -51,21 +51,21 @@ Sum of appointment durations: Somme de la durée des rendez-vous Get the sum of appointment durations according to various filters: Calcule la somme des durées des rendez-vous en fonction de différents paramètres. 'Filtered by agent: only %agents%': "Filtré par agents: uniquement %agents%" -Filter by agent: Filtrer par agents -Filter by agent job: Filtrer par métiers des agents +Filter appointments by agent: Filtrer les rendez-vous par agents +Filter appointments by agent job: Filtrer les rendez-vous par métiers des agents 'Filtered by agent job: only %jobs%': 'Filtré par métiers des agents: uniquement les %jobs%' -Filter by agent scope: Filtrer par services des agents +Filter appointments by agent scope: Filtrer les rendez-vous par services des agents 'Filtered by agent scope: only %scopes%': 'Filtré par services des agents: uniquement les services %scopes%' -Filter by appointments between certain dates: Filtrer par date du rendez-vous +Filter appointments between certain dates: Filtrer les rendez-vous par date du rendez-vous 'Filtered by appointments between %dateFrom% and %dateTo%': 'Filtré par rendez-vous entre %dateFrom% et %dateTo%' -Group by agent: Grouper par agent -Group by agent job: Grouper par métier de l'agent -Group by agent scope: Grouper par service de l'agent -Group by location type: Grouper par type de localisation -Group by location: Grouper par lieu de rendez-vous -Group by cancel reason: Grouper par motif d'annulation -Group by month and year: Grouper par mois et année +Group appointments by agent: Grouper les rendez-vous par agent +Group appointments by agent job: Grouper les rendez-vous par métier de l'agent +Group appointments by agent scope: Grouper les rendez-vous par service de l'agent +Group appointments by location type: Grouper les rendez-vous par type de localisation +Group appointments by location: Grouper les rendez-vous par lieu de rendez-vous +Group appointments by cancel reason: Grouper les rendez-vous par motif d'annulation +Group appointments by month and year: Grouper les rendez-vous par mois et année Scope: Service Job: Métier Location type: Type de localisation From d86b86487fd0d4891484d086a653cbf9364d36b9 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 31 Aug 2022 15:27:03 +0200 Subject: [PATCH 02/18] fix some remarks in 111_export review --- .../Export/Filter/BetweenDatesFilter.php | 4 ++-- .../ChildrenNumberAggregator.php | 11 +++++++++++ .../SocialWorkAggregators/ActionTypeAggregator.php | 13 +++++++------ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php index ff7e61189..b720eb3db 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php @@ -59,9 +59,9 @@ class BetweenDatesFilter implements FilterInterface } $qb->add('where', $where); - $qb->setParameter('dateFrom', $data['date_from']); + $qb->setParameter('dateFrom', $data['date_from'], Types::DATE_MUTABLE); // modify dateTo so that entire day is also taken into account up until the beginning of the next day. - $qb->setParameter('dateTo', $data['date_to']->modify('+1 day')); + $qb->setParameter('dateTo', $data['date_to']->modify('+1 day'), Types::DATE_MUTABLE); } public function applyOn(): string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php index df50b76f0..bcfbee023 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php @@ -5,6 +5,8 @@ namespace Chill\PersonBundle\Export\Aggregator\HouseholdAggregators; use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\PersonBundle\Export\Declarations; +use Doctrine\DBAL\Types\Types; +use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -100,6 +102,15 @@ class ChildrenNumberAggregator implements AggregatorInterface $qb->expr()->isNull('composition.endDate') ) ); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('ondate', $data['on_date'], Types::DATE_MUTABLE); } /** diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php index d8f485561..c975184af 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php @@ -15,6 +15,7 @@ use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository; +use Chill\PersonBundle\Templating\Entity\SocialActionRender; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -22,12 +23,13 @@ final class ActionTypeAggregator implements AggregatorInterface { private SocialActionRepository $socialActionRepository; - private TranslatableStringHelper $translatableStringHelper; + private SocialActionRender $actionRender; - public function __construct(SocialActionRepository $socialActionRepository, TranslatableStringHelper $translatableStringHelper) - { + public function __construct( + SocialActionRepository $socialActionRepository, + SocialActionRender $actionRender + ) { $this->socialActionRepository = $socialActionRepository; - $this->translatableStringHelper = $translatableStringHelper; } public function addRole() @@ -62,7 +64,6 @@ final class ActionTypeAggregator implements AggregatorInterface public function getLabels($key, array $values, $data) { - //TODO certain social actions have the same title as other, but are linked to different social issues, should we make a visual distinction? return function ($value): string { if ('_header' === $value) { return 'Social Action Type'; @@ -70,7 +71,7 @@ final class ActionTypeAggregator implements AggregatorInterface $sa = $this->socialActionRepository->find($value); - return $this->translatableStringHelper->localize($sa->getTitle()); + return $this->actionRender->renderString($sa, []); }; } From 436f1d6c61fdd80863e75fed9f0a833ebf04ce1c Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 9 Aug 2022 12:12:52 +0200 Subject: [PATCH 03/18] exports: add new requestor aggregator --- .../RequestorAggregator.php | 122 ++++++++++++++++++ .../services/exports_accompanying_course.yaml | 7 + .../translations/messages.fr.yml | 1 + 3 files changed, 130 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php new file mode 100644 index 000000000..8d8b7029c --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php @@ -0,0 +1,122 @@ +translator = $translator; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function ($value): string { + switch ($value) { + + case '_header': + return 'Requestor'; + + case 'participation': + return $this->translator->trans('is person concerned'); + + case 'other_person': + return $this->translator->trans('is other person'); + + case 'thirdparty': + return $this->translator->trans('is thirdparty'); + + case 'no_requestor': + return $this->translator->trans('no requestor'); + + default: + throw new \LogicException(sprintf('The value %s is not valid', $value)); + } + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['requestor_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by requestor'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + /* + La requête va être différente par chaque regroupement. comment faire ? + + $qb + ->join('acp.requestorPerson','rp') + ->join('acp.requestorThirdParty','rt') + ->join('acp.participations', 'part') + ; + + $qb->addSelect('rp.id AS requestor_aggregator'); + */ + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('requestor_aggregator'); + } else { + $qb->groupBy('requestor_aggregator'); + } + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml index 2b578b4f9..1e313d59d 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml @@ -213,6 +213,13 @@ services: tags: - { name: chill.export_aggregator, alias: accompanyingcourse_administrative_location_aggregator } + chill.person.export.aggregator_requestor: + class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\RequestorAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: accompanyingcourse_requestor_aggregator } + chill.person.export.aggregator_confidential: class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ConfidentialAggregator autowire: true diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index e105dd45f..e71db1a31 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -485,6 +485,7 @@ is other person: Le demandeur est un autre usager is thirdparty: Le demandeur est un tiers no requestor: Il n'y a pas de demandeur "Filtered by requestor: only %choice%": "Filtré par présence du demandeur au sein des usagers concernés: uniquement si %choice%" +Group by requestor: Grouper selon la nature du demandeur Filter by confidential: Filtrer les parcours par confidentialité Accepted confidentials: '' From cae9dddac4355c3dd4091636df29e8f3ca04b723 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 31 Aug 2022 17:57:49 +0200 Subject: [PATCH 04/18] exports: fix acp requestor aggregator --- .../DurationAggregator.php | 18 +++--- .../RequestorAggregator.php | 60 +++++++++---------- .../translations/messages.fr.yml | 6 +- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php index 2a0215e82..ec9d1c1c6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php @@ -35,10 +35,10 @@ class DurationAggregator implements AggregatorInterface */ public function getLabels($key, array $values, $data) { - return function ($value) use ($data): string { + return function ($value) use ($data): ?string { if ($value === '_header') { - return $this->translator->trans('Rounded month duration'); + return 'Rounded month duration'; } if ($value === null) { @@ -105,12 +105,14 @@ class DurationAggregator implements AggregatorInterface // https://packagist.org/packages/doctrineum/date-interval#3.1.0 // (composer fait un conflit de dépendance) - //->addSelect(" - // EXTRACT( - // month FROM - // DATE_INTERVAL(acp.closingDate, acp.openingDate) - // ) - // AS duration_aggregator") + /* + ->addSelect(" + EXTRACT( + month FROM + DATE_INTERVAL(acp.closingDate, acp.openingDate) + ) + AS duration_aggregator") + */ // NON //->addSelect("BETWEEN acp.openingDate AND acp.closingDate AS duration_aggregator") diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php index 8d8b7029c..06d09f776 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php @@ -30,27 +30,11 @@ class RequestorAggregator implements AggregatorInterface */ public function getLabels($key, array $values, $data) { - return function ($value): string { - switch ($value) { - - case '_header': - return 'Requestor'; - - case 'participation': - return $this->translator->trans('is person concerned'); - - case 'other_person': - return $this->translator->trans('is other person'); - - case 'thirdparty': - return $this->translator->trans('is thirdparty'); - - case 'no_requestor': - return $this->translator->trans('no requestor'); - - default: - throw new \LogicException(sprintf('The value %s is not valid', $value)); + return function ($value) use ($data): string { + if ($value === '_header') { + return 'Requestor'; } + return $this->translator->trans($value); }; } @@ -59,7 +43,9 @@ class RequestorAggregator implements AggregatorInterface */ public function getQueryKeys($data): array { - return ['requestor_aggregator']; + return [ + 'requestor_aggregator' + ]; } /** @@ -91,17 +77,27 @@ class RequestorAggregator implements AggregatorInterface */ public function alterQuery(QueryBuilder $qb, $data) { - /* - La requête va être différente par chaque regroupement. comment faire ? + if (!in_array('part', $qb->getAllAliases())) { + $qb->join('acp.participations', 'part'); + } - $qb - ->join('acp.requestorPerson','rp') - ->join('acp.requestorThirdParty','rt') - ->join('acp.participations', 'part') - ; - - $qb->addSelect('rp.id AS requestor_aggregator'); - */ + $qb->addSelect(" + ( CASE + WHEN acp.requestorPerson IS NOT NULL + THEN + ( CASE + WHEN acp.requestorPerson = part.person + THEN 'is person concerned' + ELSE 'is other person' + END ) + ELSE + ( CASE + WHEN acp.requestorThirdParty IS NOT NULL + THEN 'is thirdparty' + ELSE 'no requestor' + END ) + END ) AS requestor_aggregator + "); $groupBy = $qb->getDQLPart('groupBy'); @@ -110,6 +106,8 @@ class RequestorAggregator implements AggregatorInterface } else { $qb->groupBy('requestor_aggregator'); } + + // TODO 'order by' ne fonctionne pas, l'ordre n'est pas terrible } /** diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index e71db1a31..511bb791f 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -481,11 +481,11 @@ Group by administrative location: Grouper les parcours par localisation administ Filter by requestor: Filtrer les parcours selon la présence du demandeur au sein des usagers concernés Accepted choices: '' is person concerned: Le demandeur est un usager concerné -is other person: Le demandeur est un autre usager +is other person: Le demandeur est un usager, mais n'est pas concerné is thirdparty: Le demandeur est un tiers -no requestor: Il n'y a pas de demandeur +no requestor: Le parcours ne comporte pas de demandeur "Filtered by requestor: only %choice%": "Filtré par présence du demandeur au sein des usagers concernés: uniquement si %choice%" -Group by requestor: Grouper selon la nature du demandeur +Group by requestor: Grouper les parcours selon la nature du demandeur Filter by confidential: Filtrer les parcours par confidentialité Accepted confidentials: '' From 374ad43df6c378b8eca7b1e615b816fe3f9de5f9 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 1 Sep 2022 10:11:53 +0200 Subject: [PATCH 05/18] exports: cleaning code --- .../ACPAggregators/DateAggregator.php | 2 +- .../DurationAggregator.php | 58 ++++--------------- .../RequestorAggregator.php | 15 +---- .../RequestorFilter.php | 2 +- 4 files changed, 15 insertions(+), 62 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php index 1c2f02d3b..ace5557d4 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php @@ -96,7 +96,7 @@ class DateAggregator implements AggregatorInterface $fmt = 'IW'; break; case 'year': - $fmt = 'YYYY'; $order = 'DESC'; break; + $fmt = 'YYYY'; $order = 'DESC'; break; // order DESC does not works ! default: throw new RuntimeException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php index ec9d1c1c6..a738283ec 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php @@ -12,16 +12,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Contracts\Translation\TranslatorInterface; -/** - * Les regroupements seront un nombre de mois, arrondi à l'unité la plus proche (donc - * - au dela de 15 jours => 1 mois, - * - jusqu'à 45 jours => 1 mois, - * 15 | 45 | 75 - * --+----o----+----o----+---- - * | 30 | 60 | - * etc.) - */ -class DurationAggregator implements AggregatorInterface +final class DurationAggregator implements AggregatorInterface { private TranslatorInterface $translator; @@ -49,7 +40,7 @@ class DurationAggregator implements AggregatorInterface return $this->translator->trans("duration 0 month"); } - return ''. $value . $this->translator->trans(' months'); + return $value . $this->translator->trans(' months'); }; } @@ -90,44 +81,15 @@ class DurationAggregator implements AggregatorInterface */ public function alterQuery(QueryBuilder $qb, $data) { - $qb - // OUI - ->addSelect(' - (acp.closingDate - acp.openingDate +15) *12/365 - AS duration_aggregator' - ) - //->addSelect('DATE_DIFF(acp.closingDate, acp.openingDate) AS duration_aggregator') - //->addSelect('EXTRACT(month FROM acp.openingDate) AS duration_aggregator') - //->addSelect("DATE_SUB(acp.openingDate, 6, 'day') AS duration_aggregator") + $qb->addSelect(' + (acp.closingDate - acp.openingDate +15) *12/365 + AS duration_aggregator' + ); - // TODO adapter la fonction extract pour l'utiliser avec des intervals: extract(month from interval) - // et ajouter une fonction custom qui calcule les intervals, comme doctrineum/date-interval - // https://packagist.org/packages/doctrineum/date-interval#3.1.0 - // (composer fait un conflit de dépendance) - - /* - ->addSelect(" - EXTRACT( - month FROM - DATE_INTERVAL(acp.closingDate, acp.openingDate) - ) - AS duration_aggregator") - */ - - // NON - //->addSelect("BETWEEN acp.openingDate AND acp.closingDate AS duration_aggregator") - //->addSelect("EXTRACT(month FROM DATE_SUB(acp.openingDate, 6, 'day')) AS duration_aggregator") - //->addSelect('EXTRACT(month FROM DATE_DIFF(acp.closingDate, acp.openingDate)) AS duration_aggregator') - /* - ->addSelect(' - ( CASE - WHEN EXTRACT(day FROM DATE_DIFF(acp.closingDate, acp.openingDate)) > 15 - THEN EXTRACT(month FROM DATE_DIFF(acp.closingDate, acp.openingDate)) +1 - ELSE EXTRACT(month FROM DATE_DIFF(acp.closingDate, acp.openingDate)) - END ) AS duration_aggregator - ') - */ - ; + // TODO Pour avoir un interval plus précis (nécessaire ?): + // adapter la fonction extract pour pouvoir l'utiliser avec des intervals: extract(month from interval) + // et ajouter une fonction custom qui calcule plus précisément les intervals, comme doctrineum/date-interval + // https://packagist.org/packages/doctrineum/date-interval#3.1.0 (mais composer fait un conflit de dépendance) $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php index 06d09f776..916596b03 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php @@ -8,14 +8,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Contracts\Translation\TranslatorInterface; -/** - * les regroupements suivants seront effecturés: - * - le demandeur est un usager concerné - * - le demander est un usager, mais non concerné - * - le demandeur est un tiers - * - le parcours ne comporte pas de demandeur - */ -class RequestorAggregator implements AggregatorInterface +final class RequestorAggregator implements AggregatorInterface { private TranslatorInterface $translator; @@ -43,9 +36,7 @@ class RequestorAggregator implements AggregatorInterface */ public function getQueryKeys($data): array { - return [ - 'requestor_aggregator' - ]; + return ['requestor_aggregator']; } /** @@ -107,7 +98,7 @@ class RequestorAggregator implements AggregatorInterface $qb->groupBy('requestor_aggregator'); } - // TODO 'order by' ne fonctionne pas, l'ordre n'est pas terrible + // TODO 'order by' does not works ! } /** diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php index 180775f01..571e36e15 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php @@ -11,7 +11,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Contracts\Translation\TranslatorInterface; -class RequestorFilter implements FilterInterface +final class RequestorFilter implements FilterInterface { private const REQUESTOR_CHOICES = [ From 8688e4d50297793caa727430f8c638a1c306229a Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 5 Sep 2022 11:51:17 +0200 Subject: [PATCH 06/18] complete maritalStatusFilter --- .../PersonFilters/FamilySituationFilter.php | 55 ------------ .../PersonFilters/MaritalStatusFilter.php | 84 +++++++++++++++++++ .../translations/messages.fr.yml | 4 + 3 files changed, 88 insertions(+), 55 deletions(-) delete mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/FamilySituationFilter.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/FamilySituationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/FamilySituationFilter.php deleted file mode 100644 index e1a6c7529..000000000 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/FamilySituationFilter.php +++ /dev/null @@ -1,55 +0,0 @@ -add('date_calc', DateType::class, [ - 'label' => 'Family composition(s) at this time', - 'data' => new DateTime(), - ]); - } - - public function describeAction($data, $format = 'string') - { - return ['Filtered by person\'s family situation']; - } - - public function getTitle() - { - return 'Filter by person\'s family situation'; - } -} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php new file mode 100644 index 000000000..985bfe741 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php @@ -0,0 +1,84 @@ +getDQLPart('where'); + + $clause = $qb->expr()->andX( + $qb->expr()->in('p.maritalStatus', ':maritalStatus'), + $qb->expr()->eq('p.maritalStatusDate', ':calc_date') + ); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('maritalStatus', $data['maritalStatus']); + $qb->setParameter('maritalStatusDate', $data['calc_date']); + } + + public function applyOn() + { + return Declarations::PERSON_TYPE; + } + + public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder) + { + $builder->add('maritalStatus', EntityType::class, [ + 'class' => MaritalStatus::class, + 'choice_label' => function (MaritalStatus $ms) { + return $this->translatableStringHelper->localize( + $ms->getLabel() + ); + }, + 'multiple' => true, + 'expanded' => true + ]); + + $builder->add('date_calc', DateType::class, [ + 'label' => 'Marital status at this time', + 'data' => new DateTime(), + ]); + } + + public function describeAction($data, $format = 'string') + { + return ['Filtered by person\'s marital status']; + } + + public function getTitle() + { + return 'Filter by person\'s marital status'; + } +} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index e105dd45f..7cf7d34b9 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -400,6 +400,10 @@ Filtered by person\'s who have a residential address located at a thirdparty of Family composition: Composition familiale Family composition at this time: Composition familiale à cette date. +Filtered by person's marital status: Filtré par état matrimonial +Filter by person's marital status: Filtrer par état matrimonial à une certaine date. +Marital status at this time: État matrimonial à cette date. + Filter by entrusted child status: Filtrer les usagers qui sont "enfant confié" Filtered by entrusted child status: Uniquement les usagers qui sont "enfant confié" From c4f0ad01d3be91a7cc7d90eb993ba45f50163dbe Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 5 Sep 2022 12:37:00 +0200 Subject: [PATCH 07/18] disable/comment buildForm in SocialWorkType Filter --- .../SocialWorkTypeFilter.php | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php index efd8c93af..3e5889cb0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php @@ -56,34 +56,36 @@ class SocialWorkTypeFilter implements FilterInterface 'expanded' => true ]); + /* $refreshGoals = function (FormInterface $form, SocialAction $actionType = null) { $goals = null === $actionType ? [] : $actionType->getGoals(); $form->add('goal', ChoiceType::class, [ - 'placeholder' => '', - 'choices' => $goals, - 'choice_label' => function (Goal $g) { - return $this->translatableStringHelper->localize($g->getTitle()); - }, - ]); + 'placeholder' => '', + 'choices' => $goals, + 'choice_label' => function (Goal $g) { + return $this->translatableStringHelper->localize($g->getTitle()); + }, + ]); }; $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($refreshGoals) { - $data = $event->getData(); - dump($data); + $data = $event->getData(); + dump($data); - $refreshGoals($event->getForm(), $data); - }); + $refreshGoals($event->getForm(), $data); + }); -/* $builder->get('actionType')->addEventListener( + $builder->get('actionType')->addEventListener( FormEvents::POST_SUBMIT, function (FormEvent $event) use ($refreshGoals) { $actionType = $event->getForm()->getData(); dump($actionType); $refreshGoals($event->getForm()->getParent(), $actionType); } - );*/ + ); + */ } public function getTitle(): string From c442529799387c25d92326a1c70c968cc95f2bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 5 Sep 2022 14:49:07 +0200 Subject: [PATCH 08/18] fix cs --- .../BySocialActionAggregator.php | 69 +++---- .../BySocialIssueAggregator.php | 74 ++++---- .../ACPAggregators/ByThirdpartyAggregator.php | 73 ++++---- .../ACPAggregators/ByUserAggregator.php | 73 ++++---- .../ACPAggregators/DateAggregator.php | 122 +++++++------ .../ACPAggregators/LocationTypeAggregator.php | 72 ++++---- .../ACPAggregators/UserScopeAggregator.php | 72 ++++---- .../Aggregator/ActivityTypeAggregator.php | 3 +- .../Aggregator/ActivityUserAggregator.php | 4 +- .../Export/Declarations.php | 4 +- .../LinkedToACP/AvgActivityDuration.php | 37 ++-- .../LinkedToACP/AvgActivityVisitDuration.php | 37 ++-- .../Export/LinkedToACP/CountActivity.php | 17 +- .../LinkedToACP/SumActivityDuration.php | 37 ++-- .../LinkedToACP/SumActivityVisitDuration.php | 36 ++-- .../Export/LinkedToPerson/CountActivity.php | 18 +- .../Export/LinkedToPerson/ListActivity.php | 14 +- .../LinkedToPerson/StatActivityDuration.php | 12 +- .../ACPFilters/BySocialActionFilter.php | 77 ++++---- .../Filter/ACPFilters/BySocialIssueFilter.php | 75 ++++---- .../Export/Filter/ACPFilters/ByUserFilter.php | 78 ++++---- .../Filter/ACPFilters/EmergencyFilter.php | 74 ++++---- .../Filter/ACPFilters/LocationTypeFilter.php | 82 +++++---- .../Filter/ACPFilters/SentReceivedFilter.php | 67 +++---- .../Export/Filter/ACPFilters/UserFilter.php | 76 ++++---- .../Filter/ACPFilters/UserScopeFilter.php | 85 +++++---- .../Export/Filter/ActivityDateFilter.php | 3 +- .../Export/Aggregator/AgentAggregator.php | 19 +- .../Aggregator/CancelReasonAggregator.php | 72 ++++---- .../Export/Aggregator/JobAggregator.php | 72 ++++---- .../Export/Aggregator/LocationAggregator.php | 68 +++---- .../Aggregator/LocationTypeAggregator.php | 71 ++++---- .../Export/Aggregator/MonthYearAggregator.php | 70 ++++---- .../Export/Aggregator/ScopeAggregator.php | 72 ++++---- .../Export/Export/CountAppointments.php | 29 +-- .../Export/StatAppointmentAvgDuration.php | 38 ++-- .../Export/StatAppointmentSumDuration.php | 37 ++-- .../Export/Filter/AgentFilter.php | 74 ++++---- .../Export/Filter/BetweenDatesFilter.php | 68 +++---- .../Export/Filter/JobFilter.php | 57 +++--- .../Export/Filter/ScopeFilter.php | 59 +++--- .../Controller/ExportController.php | 30 ++-- .../ChillMainBundle/Doctrine/DQL/Extract.php | 15 +- .../ChillMainBundle/Doctrine/DQL/ToChar.php | 14 +- .../migrations/Version20220829132409.php | 21 ++- .../HouseholdCompositionTypeController.php | 2 +- .../ChillPersonExtension.php | 1 + .../Entity/MaritalStatus.php | 1 - .../AdministrativeLocationAggregator.php | 89 ++++------ .../ClosingMotiveAggregator.php | 93 +++++----- .../ConfidentialAggregator.php | 105 +++++------ .../DurationAggregator.php | 118 ++++++------ .../EmergencyAggregator.php | 105 +++++------ .../EvaluationAggregator.php | 95 +++++----- .../IntensityAggregator.php | 99 +++++------ .../JobAggregator.php | 94 +++++----- .../OriginAggregator.php | 96 +++++----- .../ReferrerAggregator.php | 6 +- .../ScopeAggregator.php | 94 +++++----- .../SocialActionAggregator.php | 91 +++++----- .../SocialIssueAggregator.php | 92 ++++------ .../StepAggregator.php | 114 ++++++------ .../EvaluationTypeAggregator.php | 88 ++++----- .../ChildrenNumberAggregator.php | 101 +++++------ .../CompositionAggregator.php | 104 +++++------ .../HouseholdPositionAggregator.php | 6 +- .../MaritalStatusAggregator.php | 1 - .../NationalityAggregator.php | 7 +- .../ActionTypeAggregator.php | 1 - .../SocialWorkAggregators/GoalAggregator.php | 1 - .../SocialWorkAggregators/JobAggregator.php | 94 +++++----- .../ReferrerAggregator.php | 6 +- .../ResultAggregator.php | 1 - .../SocialWorkAggregators/ScopeAggregator.php | 94 +++++----- .../ChillPersonBundle/Export/Declarations.php | 12 +- .../Export/Export/CountAccompanyingCourse.php | 24 +-- .../Export/Export/CountEvaluation.php | 68 +++---- .../Export/Export/CountHousehold.php | 67 +++---- .../Export/Export/CountPerson.php | 11 +- .../CountPersonWithAccompanyingCourse.php | 69 +++---- .../Export/Export/CountSocialWorkActions.php | 27 ++- .../Export/Export/ListPerson.php | 13 +- .../Export/Export/ListPersonDuplicate.php | 10 +- .../Export/StatAccompanyingCourseDuration.php | 66 ++----- .../ActiveOnDateFilter.php | 73 ++++---- .../ActiveOneDayBetweenDatesFilter.php | 81 ++++----- .../ActivityTypeFilter.php | 95 +++++----- .../AdministrativeLocationFilter.php | 92 +++++----- .../ClosingMotiveFilter.php | 96 +++++----- .../ConfidentialFilter.php | 84 +++++---- .../CurrentUserJobFilter.php | 26 +-- .../CurrentUserScopeFilter.php | 31 ++-- .../EmergencyFilter.php | 80 +++++---- .../EvaluationFilter.php | 95 +++++----- .../GeographicalUnitStatFilter.php | 89 +++++----- .../IntensityFilter.php | 80 +++++---- .../OpenBetweenDatesFilter.php | 81 ++++----- .../OriginFilter.php | 93 +++++----- .../ReferrerFilter.php | 93 +++++----- .../RequestorFilter.php | 101 +++++------ .../SocialActionFilter.php | 84 ++++----- .../SocialIssueFilter.php | 168 +++++++++--------- .../AccompanyingCourseFilters/StepFilter.php | 66 +++---- .../EvaluationTypeFilter.php | 93 +++++----- .../EvaluationFilters/MaxDateFilter.php | 85 ++++----- .../HouseholdFilters/CompositionFilter.php | 112 ++++++------ .../Export/Filter/PersonFilters/AgeFilter.php | 8 +- .../Filter/PersonFilters/BirthdateFilter.php | 5 +- .../PersonFilters/DeadOrAliveFilter.php | 10 +- .../PersonFilters/FamilySituationFilter.php | 2 - .../ResidentialAddressAtThirdpartyFilter.php | 41 +++-- .../ResidentialAddressAtUserFilter.php | 6 +- .../Filter/SocialWorkFilters/JobFilter.php | 60 +++---- .../SocialWorkFilters/ReferrerFilter.php | 93 +++++----- .../Filter/SocialWorkFilters/ScopeFilter.php | 59 +++--- .../SocialWorkTypeFilter.php | 168 +++++++++--------- .../Form/HouseholdCompositionTypeType.php | 3 +- .../AccompanyingPeriodWorkRepository.php | 10 +- .../Repository/PersonRepository.php | 10 +- .../Authorization/AccompanyingPeriodVoter.php | 15 +- .../Export/CountAccompanyingCourseTest.php | 24 +-- .../Export/CountSocialWorkActionsTest.php | 25 +-- .../StatAccompanyingCourseDurationTest.php | 18 +- .../Export/Filter/ActiveOnDateFilterTest.php | 29 +-- .../ActiveOneDayBetweenDatesFilterTest.php | 31 ++-- .../Export/Filter/ActivityTypeFilterTest.php | 29 +-- .../AdministrativeLocationFilterTest.php | 28 +-- .../Export/Filter/ClosingMotiveFilterTest.php | 29 +-- .../Export/Filter/ConfidentialFilterTest.php | 29 +-- .../Export/Filter/EmergencyFilterTest.php | 20 ++- .../Export/Filter/EvaluationFilterTest.php | 28 +-- .../Filter/GeographicalUnitStatFilterTest.php | 31 ++-- .../Export/Filter/IntensityFilterTest.php | 29 +-- .../Tests/Export/Filter/JobFilterTest.php | 28 +-- .../Filter/OpenBetweenDatesFilterTest.php | 31 ++-- .../Tests/Export/Filter/OriginFilterTest.php | 29 +-- .../Export/Filter/ReferrerFilterTest.php | 28 +-- .../Export/Filter/RequestorFilterTest.php | 27 +-- .../Tests/Export/Filter/ScopeFilterTest.php | 29 +-- .../Export/Filter/SocialActionFilterTest.php | 28 +-- .../Export/Filter/SocialIssueFilterTest.php | 29 +-- .../Tests/Export/Filter/StepFilterTest.php | 27 +-- .../Tests/Export/Filter/UserJobFilterTest.php | 27 +-- .../Export/Filter/UserScopeFilterTest.php | 28 +-- 144 files changed, 3683 insertions(+), 3809 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php index 269924a8a..62b160bc1 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php @@ -1,5 +1,12 @@ actionRepository = $actionRepository; } - public function getLabels($key, array $values, $data) - { - return function($value) { - if ('_header' === $value) { - return 'Social action'; - } - - $sa = $this->actionRepository->find($value); - - return $this->actionRender->renderString($sa, []); - }; - } - - public function getQueryKeys($data): array - { - return ['socialaction_aggregator']; - } - - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - public function getTitle(): string - { - return 'Group activity by linked socialaction'; - } - public function addRole() { return null; @@ -61,7 +40,7 @@ class BySocialActionAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - if(!in_array('socialaction', $qb->getAllAliases())) { + if (!in_array('socialaction', $qb->getAllAliases(), true)) { $qb->join('activity.socialActions', 'socialaction'); } @@ -80,4 +59,32 @@ class BySocialActionAggregator implements AggregatorInterface { return Declarations::ACTIVITY_ACP; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value) { + if ('_header' === $value) { + return 'Social action'; + } + + $sa = $this->actionRepository->find($value); + + return $this->actionRender->renderString($sa, []); + }; + } + + public function getQueryKeys($data): array + { + return ['socialaction_aggregator']; + } + + public function getTitle(): string + { + return 'Group activity by linked socialaction'; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php index 0e4b9ab8e..ff70e54b9 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php @@ -1,5 +1,12 @@ issueRender = $issueRender; } - public function getLabels($key, array $values, $data) - { - return function ($value): string { - - if ($value === '_header') { - return 'Social issues'; - } - - $i = $this->issueRepository->find($value); - - return $this->issueRender->renderString($i, []); - }; - } - - public function getQueryKeys($data): array - { - return ['socialissue_aggregator']; - } - - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - public function getTitle(): string - { - return 'Group activity by linked socialissue'; - } - public function addRole() { return null; @@ -62,7 +40,7 @@ class BySocialIssueAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('socialissue', $qb->getAllAliases())) { + if (!in_array('socialissue', $qb->getAllAliases(), true)) { $qb->join('activity.socialIssues', 'socialissue'); } @@ -81,4 +59,32 @@ class BySocialIssueAggregator implements AggregatorInterface { return Declarations::ACTIVITY_ACP; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Social issues'; + } + + $i = $this->issueRepository->find($value); + + return $this->issueRender->renderString($i, []); + }; + } + + public function getQueryKeys($data): array + { + return ['socialissue_aggregator']; + } + + public function getTitle(): string + { + return 'Group activity by linked socialissue'; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php index 5a9e633ef..ce70a9ddb 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php @@ -1,5 +1,12 @@ thirdPartyRender = $thirdPartyRender; } - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ($value === '_header') { - return 'Accepted thirdparty'; - } - - $tp = $this->thirdPartyRepository->find($value); - - return $this->thirdPartyRender->renderString($tp, []); - }; - } - - public function getQueryKeys($data): array - { - return ['thirdparty_aggregator']; - } - - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - public function getTitle(): string - { - return 'Group activity by linked thirdparties'; - } - public function addRole() { return null; @@ -61,7 +40,7 @@ class ByThirdpartyAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('thirdparty', $qb->getAllAliases())) { + if (!in_array('thirdparty', $qb->getAllAliases(), true)) { $qb->join('activity.thirdParties', 'thirdparty'); } @@ -80,4 +59,32 @@ class ByThirdpartyAggregator implements AggregatorInterface { return Declarations::ACTIVITY_ACP; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Accepted thirdparty'; + } + + $tp = $this->thirdPartyRepository->find($value); + + return $this->thirdPartyRender->renderString($tp, []); + }; + } + + public function getQueryKeys($data): array + { + return ['thirdparty_aggregator']; + } + + public function getTitle(): string + { + return 'Group activity by linked thirdparties'; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php index 95c9998b8..d57410c4b 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php @@ -1,5 +1,12 @@ userRender = $userRender; } - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ($value === '_header') { - return 'Accepted users'; - } - - $u = $this->userRepository->find($value); - - return $this->userRender->renderString($u, []); - }; - } - - public function getQueryKeys($data): array - { - return ['users_aggregator']; - } - - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - public function getTitle(): string - { - return 'Group activity by linked users'; - } - public function addRole() { return null; @@ -61,7 +40,7 @@ class ByUserAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('user', $qb->getAllAliases())) { + if (!in_array('user', $qb->getAllAliases(), true)) { $qb->join('activity.users', 'user'); } @@ -80,4 +59,32 @@ class ByUserAggregator implements AggregatorInterface { return Declarations::ACTIVITY_ACP; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Accepted users'; + } + + $u = $this->userRepository->find($value); + + return $this->userRender->renderString($u, []); + }; + } + + public function getQueryKeys($data): array + { + return ['users_aggregator']; + } + + public function getTitle(): string + { + return 'Group activity by linked users'; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php index 1c2f02d3b..3463b1c59 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php @@ -1,12 +1,19 @@ 'year', ]; - private CONST DEFAULT_CHOICE = 'year'; + private const DEFAULT_CHOICE = 'year'; private TranslatorInterface $translator; @@ -31,54 +38,6 @@ class DateAggregator implements AggregatorInterface $this->translator = $translator; } - public function getLabels($key, array $values, $data) - { - return function ($value) use ($data): string { - if ($value === '_header') { - return 'by '. $data['frequency']; - } - switch ($data['frequency']) { - case 'month': - $month = \DateTime::createFromFormat('!m', $value); - return sprintf( - "%02d (%s)", - $value, - $month->format('M') - ); - - case 'week': - //return $this->translator->trans('for week') .' '. $value ; - - case 'year': - //return $this->translator->trans('in year') .' '. $value ; - - default: - return $value; - } - }; - } - - public function getQueryKeys($data): array - { - return ['date_aggregator']; - } - - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('frequency', ChoiceType::class, [ - 'choices' => self::CHOICES, - 'multiple' => false, - 'expanded' => true, - 'empty_data' => self::DEFAULT_CHOICE, - 'data' => self::DEFAULT_CHOICE, - ]); - } - - public function getTitle(): string - { - return 'Group activity by date'; - } - public function addRole() { return null; @@ -90,13 +49,19 @@ class DateAggregator implements AggregatorInterface switch ($data['frequency']) { case 'month': - $fmt = 'MM'; break; + $fmt = 'MM'; + +break; case 'week': - $fmt = 'IW'; break; + $fmt = 'IW'; + +break; case 'year': - $fmt = 'YYYY'; $order = 'DESC'; break; + $fmt = 'YYYY'; $order = 'DESC'; + +break; default: throw new RuntimeException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])); @@ -126,4 +91,53 @@ class DateAggregator implements AggregatorInterface return Declarations::ACTIVITY_ACP; } -} \ No newline at end of file + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('frequency', ChoiceType::class, [ + 'choices' => self::CHOICES, + 'multiple' => false, + 'expanded' => true, + 'empty_data' => self::DEFAULT_CHOICE, + 'data' => self::DEFAULT_CHOICE, + ]); + } + + public function getLabels($key, array $values, $data) + { + return static function ($value) use ($data): string { + if ('_header' === $value) { + return 'by ' . $data['frequency']; + } + + switch ($data['frequency']) { + case 'month': + $month = DateTime::createFromFormat('!m', $value); + + return sprintf( + '%02d (%s)', + $value, + $month->format('M') + ); + + case 'week': + //return $this->translator->trans('for week') .' '. $value ; + + case 'year': + //return $this->translator->trans('in year') .' '. $value ; + + default: + return $value; + } + }; + } + + public function getQueryKeys($data): array + { + return ['date_aggregator']; + } + + public function getTitle(): string + { + return 'Group activity by date'; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php index aa5052aaa..c5f43cc64 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php @@ -1,5 +1,12 @@ translatableStringHelper = $translatableStringHelper; } - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ($value === '_header') { - return 'Accepted locationtype'; - } - - $lt = $this->locationTypeRepository->find($value); - - return $this->translatableStringHelper->localize( - $lt->getTitle() - ); - }; - } - - public function getQueryKeys($data): array - { - return ['locationtype_aggregator']; - } - - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - public function getTitle(): string - { - return 'Group activity by locationtype'; - } - public function addRole() { return null; @@ -63,7 +40,7 @@ class LocationTypeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('location', $qb->getAllAliases())) { + if (!in_array('location', $qb->getAllAliases(), true)) { $qb->join('activity.location', 'location'); } @@ -83,4 +60,33 @@ class LocationTypeAggregator implements AggregatorInterface return Declarations::ACTIVITY_ACP; } -} \ No newline at end of file + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Accepted locationtype'; + } + + $lt = $this->locationTypeRepository->find($value); + + return $this->translatableStringHelper->localize( + $lt->getTitle() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['locationtype_aggregator']; + } + + public function getTitle(): string + { + return 'Group activity by locationtype'; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/UserScopeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/UserScopeAggregator.php index 4d6cef24a..67c2d8db1 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/UserScopeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/UserScopeAggregator.php @@ -1,5 +1,12 @@ translatableStringHelper = $translatableStringHelper; } - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ($value === '_header') { - return 'Scope'; - } - - $s = $this->scopeRepository->find($value); - - return $this->translatableStringHelper->localize( - $s->getName() - ); - }; - } - - public function getQueryKeys($data): array - { - return ['userscope_aggregator']; - } - - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - public function getTitle(): string - { - return 'Group activity by userscope'; - } - public function addRole() { return null; @@ -63,7 +40,7 @@ class UserScopeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('user', $qb->getAllAliases())) { + if (!in_array('user', $qb->getAllAliases(), true)) { $qb->join('activity.user', 'user'); } @@ -83,4 +60,33 @@ class UserScopeAggregator implements AggregatorInterface return Declarations::ACTIVITY_ACP; } -} \ No newline at end of file + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Scope'; + } + + $s = $this->scopeRepository->find($value); + + return $this->translatableStringHelper->localize( + $s->getName() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['userscope_aggregator']; + } + + public function getTitle(): string + { + return 'Group activity by userscope'; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php index cedd2df8c..3637d70c6 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php @@ -21,6 +21,7 @@ use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; +use function in_array; class ActivityTypeAggregator implements AggregatorInterface { @@ -45,7 +46,7 @@ class ActivityTypeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('type', $qb->getAllAliases())) { + if (!in_array('type', $qb->getAllAliases(), true)) { $qb->join('activity.activityType', 'type'); } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php index 675098c60..6d6d3a837 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php @@ -25,10 +25,10 @@ class ActivityUserAggregator implements AggregatorInterface { public const KEY = 'activity_user_id'; - private UserRepository $userRepository; - private UserRender $userRender; + private UserRepository $userRepository; + public function __construct( UserRepository $userRepository, UserRender $userRender diff --git a/src/Bundle/ChillActivityBundle/Export/Declarations.php b/src/Bundle/ChillActivityBundle/Export/Declarations.php index 7a5b47028..82f01bcb2 100644 --- a/src/Bundle/ChillActivityBundle/Export/Declarations.php +++ b/src/Bundle/ChillActivityBundle/Export/Declarations.php @@ -18,7 +18,7 @@ abstract class Declarations { public const ACTIVITY = 'activity'; - public const ACTIVITY_ACP = "activity_linked_to_acp"; + public const ACTIVITY_ACP = 'activity_linked_to_acp'; - public const ACTIVITY_PERSON = "activity_linked_to_person"; + public const ACTIVITY_PERSON = 'activity_linked_to_person'; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php index 1ae5d1830..d06116787 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php @@ -1,5 +1,14 @@ getQuery()->getResult(Query::HYDRATE_SCALAR); } + public function getTitle(): string + { + return 'Average activity linked to an accompanying period duration'; + } + public function getType(): string { return Declarations::ACTIVITY; @@ -73,8 +85,7 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { $qb = $this->repository->createQueryBuilder('activity') - ->join('activity.accompanyingPeriod', 'acp') - ; + ->join('activity.accompanyingPeriod', 'acp'); $qb->select('AVG(activity.durationTime) as export_avg_activity_duration'); @@ -94,10 +105,4 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface //PersonDeclarations::ACP_TYPE, ]; } - - public function getGroup(): string - { - return 'Exports of activities linked to an accompanying period'; - } - -} \ No newline at end of file +} diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php index b03378b16..535fe3d85 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php @@ -1,5 +1,14 @@ getQuery()->getResult(Query::HYDRATE_SCALAR); } + public function getTitle(): string + { + return 'Average activity linked to an accompanying period visit duration'; + } + public function getType(): string { return Declarations::ACTIVITY; @@ -73,8 +85,7 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { $qb = $this->repository->createQueryBuilder('activity') - ->join('activity.accompanyingPeriod', 'acp') - ; + ->join('activity.accompanyingPeriod', 'acp'); $qb->select('AVG(activity.travelTime) as export_avg_activity_visit_duration'); @@ -94,10 +105,4 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac //PersonDeclarations::ACP_TYPE, ]; } - - public function getGroup(): string - { - return 'Exports of activities linked to an accompanying period'; - } - -} \ No newline at end of file +} diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php index 55c0a1974..cefb5e0e9 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php @@ -30,7 +30,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface protected EntityRepository $repository; public function __construct( - EntityManagerInterface $em + EntityManagerInterface $em ) { $this->repository = $em->getRepository(Activity::class); } @@ -49,6 +49,11 @@ class CountActivity implements ExportInterface, GroupedExportInterface return 'Count activities linked to an accompanying period by various parameters.'; } + public function getGroup(): string + { + return 'Exports of activities linked to an accompanying period'; + } + public function getLabels($key, array $values, $data) { if ('export_count_activity' !== $key) { @@ -81,11 +86,10 @@ class CountActivity implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { $qb = $this->repository->createQueryBuilder('activity') - ->join('activity.accompanyingPeriod', 'acp') - ; + ->join('activity.accompanyingPeriod', 'acp'); $qb->select('COUNT(activity.id) as export_count_activity'); - + return $qb; } @@ -102,9 +106,4 @@ class CountActivity implements ExportInterface, GroupedExportInterface //PersonDeclarations::ACP_TYPE, ]; } - - public function getGroup(): string - { - return 'Exports of activities linked to an accompanying period'; - } } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php index 3ab192702..7ba914ee5 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php @@ -1,5 +1,14 @@ getQuery()->getResult(Query::HYDRATE_SCALAR); } + public function getTitle(): string + { + return 'Sum activity linked to an accompanying period duration'; + } + public function getType(): string { return Declarations::ACTIVITY; @@ -73,8 +85,7 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { $qb = $this->repository->createQueryBuilder('activity') - ->join('activity.accompanyingPeriod', 'acp') - ; + ->join('activity.accompanyingPeriod', 'acp'); $qb->select('SUM(activity.durationTime) as export_sum_activity_duration'); @@ -94,10 +105,4 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface //PersonDeclarations::ACP_TYPE, ]; } - - public function getGroup(): string - { - return 'Exports of activities linked to an accompanying period'; - } - -} \ No newline at end of file +} diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php index 452fc4de7..c3f7ef243 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php @@ -1,5 +1,14 @@ getQuery()->getResult(Query::HYDRATE_SCALAR); } + public function getTitle(): string + { + return 'Sum activity linked to an accompanying period visit duration'; + } + public function getType(): string { return Declarations::ACTIVITY; @@ -73,8 +85,7 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { $qb = $this->repository->createQueryBuilder('activity') - ->join('activity.accompanyingPeriod', 'acp') - ; + ->join('activity.accompanyingPeriod', 'acp'); $qb->select('SUM(activity.travelTime) as export_sum_activity_visit_duration'); @@ -94,9 +105,4 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac //PersonDeclarations::ACP_TYPE, ]; } - - public function getGroup(): string - { - return 'Exports of activities linked to an accompanying period'; - } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php index 75d3122c3..84baf657a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php @@ -11,12 +11,12 @@ declare(strict_types=1); namespace Chill\ActivityBundle\Export\Export\LinkedToPerson; +use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Repository\ActivityRepository; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; -use Chill\ActivityBundle\Export\Declarations; use Chill\PersonBundle\Export\Declarations as PersonDeclarations; use Doctrine\ORM\Query; use LogicException; @@ -47,6 +47,11 @@ class CountActivity implements ExportInterface, GroupedExportInterface return 'Count activities linked to a person by various parameters.'; } + public function getGroup(): string + { + return 'Exports of activities linked to a person'; + } + public function getLabels($key, array $values, $data) { if ('export_count_activity' !== $key) { @@ -81,15 +86,13 @@ class CountActivity implements ExportInterface, GroupedExportInterface $centers = array_map(static fn ($el) => $el['center'], $acl); $qb = $this->activityRepository->createQueryBuilder('activity') - ->join('activity.person', 'person') - ; + ->join('activity.person', 'person'); $qb->select('COUNT(activity.id) as export_count_activity'); $qb ->where($qb->expr()->in('person.center', ':centers')) - ->setParameter('centers', $centers) - ; + ->setParameter('centers', $centers); return $qb; } @@ -107,9 +110,4 @@ class CountActivity implements ExportInterface, GroupedExportInterface //PersonDeclarations::PERSON_TYPE, ]; } - - public function getGroup(): string - { - return 'Exports of activities linked to a person'; - } } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php index 21a68fb93..387ea8821 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php @@ -12,12 +12,14 @@ declare(strict_types=1); namespace Chill\ActivityBundle\Export\Export\LinkedToPerson; use Chill\ActivityBundle\Entity\ActivityReason; +use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Repository\ActivityRepository; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Chill\MainBundle\Export\ListInterface; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; +use Chill\PersonBundle\Export\Declarations as PersonDeclarations; use DateTime; use Doctrine\DBAL\Exception\InvalidArgumentException; use Doctrine\ORM\EntityManagerInterface; @@ -28,8 +30,6 @@ use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Validator\Constraints\Callback; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Contracts\Translation\TranslatorInterface; -use Chill\ActivityBundle\Export\Declarations; -use Chill\PersonBundle\Export\Declarations as PersonDeclarations; use function array_key_exists; use function count; @@ -100,6 +100,11 @@ class ListActivity implements ListInterface, GroupedExportInterface return 'List activities linked to a person description'; } + public function getGroup(): string + { + return 'Exports of activities linked to a person'; + } + public function getLabels($key, array $values, $data) { switch ($key) { @@ -283,9 +288,4 @@ class ListActivity implements ListInterface, GroupedExportInterface //PersonDeclarations::PERSON_TYPE, ]; } - - public function getGroup(): string - { - return 'Exports of activities linked to a person'; - } } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php index 5fae246f8..ebba5ad82 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\ActivityBundle\Export\Export\LinkedToPerson; +use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Repository\ActivityRepository; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Entity\Center; @@ -18,7 +19,6 @@ use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Chill\PersonBundle\Export\Declarations as PersonDeclarations; -use Chill\ActivityBundle\Export\Declarations; use Doctrine\ORM\Query; use LogicException; use Symfony\Component\Form\FormBuilderInterface; @@ -67,6 +67,11 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface } } + public function getGroup(): string + { + return 'Exports of activities linked to a person'; + } + public function getLabels($key, array $values, $data) { if ('export_stat_activity' !== $key) { @@ -135,9 +140,4 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface //PersonDeclarations::PERSON_TYPE, ]; } - - public function getGroup(): string - { - return 'Exports of activities linked to a person'; - } } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php index 58d77c73e..d110a829f 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php @@ -1,17 +1,25 @@ actionRender = $actionRender; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_socialactions', EntityType::class, [ - 'class' => SocialAction::class, - 'choice_label' => function (SocialAction $sa) { - return $this->actionRender->renderString($sa, []); - }, - 'multiple' => true, - 'expanded' => true, - ]); - } - - public function getTitle(): string - { - return 'Filter activity by linked socialaction'; - } - - public function describeAction($data, $format = 'string'): array - { - $actions = []; - - foreach ($data['accepted_socialactions'] as $sa) { - $actions[] = $this->actionRender->renderString($sa, []); - } - - return ['Filtered activity by linked socialaction: only %actions%', [ - '%actions%' => implode(", ou ", $actions) - ]]; - } - public function addRole() { return null; @@ -61,7 +39,7 @@ class BySocialActionFilter implements FilterInterface { $where = $qb->getDQLPart('where'); - if (!in_array('socialaction', $qb->getAllAliases())) { + if (!in_array('socialaction', $qb->getAllAliases(), true)) { $qb->join('activity.socialActions', 'socialaction'); } @@ -77,9 +55,38 @@ class BySocialActionFilter implements FilterInterface $qb->setParameter('socialactions', $data['accepted_socialactions']); } - public function applyOn(): string + public function applyOn(): string { - return Declarations::ACTIVITY_ACP; + return Declarations::ACTIVITY_ACP; } -} \ No newline at end of file + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_socialactions', EntityType::class, [ + 'class' => SocialAction::class, + 'choice_label' => function (SocialAction $sa) { + return $this->actionRender->renderString($sa, []); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $actions = []; + + foreach ($data['accepted_socialactions'] as $sa) { + $actions[] = $this->actionRender->renderString($sa, []); + } + + return ['Filtered activity by linked socialaction: only %actions%', [ + '%actions%' => implode(', ou ', $actions), + ]]; + } + + public function getTitle(): string + { + return 'Filter activity by linked socialaction'; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php index 052b780ff..66fa92dd4 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php @@ -1,17 +1,25 @@ issueRender = $issueRender; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_socialissues', EntityType::class, [ - 'class' => SocialIssue::class, - 'choice_label' => function(SocialIssue $si) { - return $this->issueRender->renderString($si, []); - }, - 'multiple' => true, - 'expanded' => true, - ]); - } - - public function getTitle(): string - { - return 'Filter activity by linked socialissue'; - } - - public function describeAction($data, $format = 'string'): array - { - $issues = []; - - foreach ($data['accepted_socialissues'] as $si) { - $issues[] = $this->issueRender->renderString($si, []); - } - - return ['Filtered activity by linked socialissue: only %issues%', [ - '%issues%' => implode(", ou ", $issues) - ]]; - } - public function addRole() { return null; @@ -61,7 +39,7 @@ class BySocialIssueFilter implements FilterInterface { $where = $qb->getDQLPart('where'); - if (!in_array('socialissue', $qb->getAllAliases())) { + if (!in_array('socialissue', $qb->getAllAliases(), true)) { $qb->join('activity.socialIssues', 'socialissue'); } @@ -77,9 +55,38 @@ class BySocialIssueFilter implements FilterInterface $qb->setParameter('socialissues', $data['accepted_socialissues']); } - public function applyOn(): string + public function applyOn(): string { return Declarations::ACTIVITY_ACP; } -} \ No newline at end of file + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_socialissues', EntityType::class, [ + 'class' => SocialIssue::class, + 'choice_label' => function (SocialIssue $si) { + return $this->issueRender->renderString($si, []); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $issues = []; + + foreach ($data['accepted_socialissues'] as $si) { + $issues[] = $this->issueRender->renderString($si, []); + } + + return ['Filtered activity by linked socialissue: only %issues%', [ + '%issues%' => implode(', ou ', $issues), + ]]; + } + + public function getTitle(): string + { + return 'Filter activity by linked socialissue'; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php index b128b03aa..512dce874 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php @@ -1,17 +1,25 @@ userRender = $userRender; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_users', EntityType::class, [ - 'class' => User::class, - 'choice_label' => function (User $u) { - return $this->userRender->renderString($u, []); - }, - 'multiple' => true, - 'expanded' => true, - ]); - } - - public function getTitle(): string - { - return 'Filter activity by linked users'; - } - - public function describeAction($data, $format = 'string'): array - { - $users = []; - - foreach ($data['accepted_users'] as $u) { - $users[] = $this->userRender->renderString($u, []); - } - - return ['Filtered activity by linked users: only %users%', [ - '%users%' => implode(", ou ", $users) - ]]; - } - public function addRole() { return null; @@ -61,7 +39,7 @@ class ByUserFilter implements FilterInterface { $where = $qb->getDQLPart('where'); - if (!in_array('user', $qb->getAllAliases())) { + if (!in_array('user', $qb->getAllAliases(), true)) { $qb->join('activity.users', 'user'); } @@ -77,8 +55,38 @@ class ByUserFilter implements FilterInterface $qb->setParameter('users', $data['accepted_users']); } - public function applyOn(): string + public function applyOn(): string { - return Declarations::ACTIVITY_ACP; + return Declarations::ACTIVITY_ACP; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_users', EntityType::class, [ + 'class' => User::class, + 'choice_label' => function (User $u) { + return $this->userRender->renderString($u, []); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $users = []; + + foreach ($data['accepted_users'] as $u) { + $users[] = $this->userRender->renderString($u, []); + } + + return ['Filtered activity by linked users: only %users%', [ + '%users%' => implode(', ou ', $users), + ]]; + } + + public function getTitle(): string + { + return 'Filter activity by linked users'; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php index d7a823891..612ef3d3d 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php @@ -1,11 +1,18 @@ false, ]; - private CONST DEFAULT_CHOICE = false; + private const DEFAULT_CHOICE = false; private TranslatorInterface $translator; @@ -28,35 +35,6 @@ class EmergencyFilter implements FilterInterface $this->translator = $translator; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_emergency', ChoiceType::class, [ - 'choices' => self::CHOICES, - 'multiple' => false, - 'expanded' => true, - 'empty_data' => self::DEFAULT_CHOICE, - 'data' => self::DEFAULT_CHOICE, - ]); - } - - public function getTitle(): string - { - return 'Filter activity by emergency'; - } - - public function describeAction($data, $format = 'string'): array - { - foreach (self::CHOICES as $k => $v) { - if ($v === $data['accepted_emergency']) { - $choice = $k; - } - } - - return ['Filtered activity by emergency: only %emergency%', [ - '%emergency%' => $this->translator->trans($choice) - ]]; - } - public function addRole() { return null; @@ -78,9 +56,37 @@ class EmergencyFilter implements FilterInterface $qb->setParameter('emergency', $data['accepted_emergency']); } - public function applyOn(): string + public function applyOn(): string { - return Declarations::ACTIVITY_ACP; + return Declarations::ACTIVITY_ACP; } -} \ No newline at end of file + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_emergency', ChoiceType::class, [ + 'choices' => self::CHOICES, + 'multiple' => false, + 'expanded' => true, + 'empty_data' => self::DEFAULT_CHOICE, + 'data' => self::DEFAULT_CHOICE, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + foreach (self::CHOICES as $k => $v) { + if ($v === $data['accepted_emergency']) { + $choice = $k; + } + } + + return ['Filtered activity by emergency: only %emergency%', [ + '%emergency%' => $this->translator->trans($choice), + ]]; + } + + public function getTitle(): string + { + return 'Filter activity by emergency'; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php index cf29f20f2..4519dd63a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php @@ -1,17 +1,25 @@ translatableStringHelper = $translatableStringHelper; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_locationtype', EntityType::class, [ - 'class' => LocationType::class, - 'choice_label' => function(LocationType $type) { - return $this->translatableStringHelper->localize($type->getTitle()); - }, - 'multiple' => true, - 'expanded' => true, - ]); - } - - public function getTitle(): string - { - return 'Filter activity by locationtype'; - } - - public function describeAction($data, $format = 'string'): array - { - $types = []; - - foreach ($data['accepted_locationtype'] as $type) { - $types[] = $this->translatableStringHelper->localize( - $type->getTitle() - ); - } - - return ['Filtered activity by locationtype: only %types%', [ - '%types%' => implode(", ou ", $types) - ]]; - } - public function addRole() { return null; @@ -61,7 +37,7 @@ class LocationTypeFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('location', $qb->getAllAliases())) { + if (!in_array('location', $qb->getAllAliases(), true)) { $qb->join('activity.location', 'location'); } @@ -78,8 +54,40 @@ class LocationTypeFilter implements FilterInterface $qb->setParameter('locationtype', $data['accepted_locationtype']); } - public function applyOn(): string + public function applyOn(): string { - return Declarations::ACTIVITY_ACP; + return Declarations::ACTIVITY_ACP; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_locationtype', EntityType::class, [ + 'class' => LocationType::class, + 'choice_label' => function (LocationType $type) { + return $this->translatableStringHelper->localize($type->getTitle()); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $types = []; + + foreach ($data['accepted_locationtype'] as $type) { + $types[] = $this->translatableStringHelper->localize( + $type->getTitle() + ); + } + + return ['Filtered activity by locationtype: only %types%', [ + '%types%' => implode(', ou ', $types), + ]]; + } + + public function getTitle(): string + { + return 'Filter activity by locationtype'; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php index 409c974ac..7c878ac75 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php @@ -1,12 +1,19 @@ Activity::SENTRECEIVED_RECEIVED, ]; - private CONST DEFAULT_CHOICE = Activity::SENTRECEIVED_SENT; + private const DEFAULT_CHOICE = Activity::SENTRECEIVED_SENT; private TranslatorInterface $translator; @@ -29,31 +36,6 @@ class SentReceivedFilter implements FilterInterface $this->translator = $translator; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_sentreceived', ChoiceType::class, [ - 'choices' => self::CHOICES, - 'multiple' => false, - 'expanded' => true, - 'empty_data' => self::DEFAULT_CHOICE, - 'data' => self::DEFAULT_CHOICE, - ]); - } - - public function getTitle(): string - { - return 'Filter activity by sentreceived'; - } - - public function describeAction($data, $format = 'string'): array - { - $sentreceived = array_flip(self::CHOICES)[$data['accepted_sentreceived']]; - - return ['Filtered activity by sentreceived: only %sentreceived%', [ - '%sentreceived%' => $this->translator->trans($sentreceived) - ]]; - } - public function addRole() { return null; @@ -75,8 +57,33 @@ class SentReceivedFilter implements FilterInterface $qb->setParameter('sentreceived', $data['accepted_sentreceived']); } - public function applyOn(): string + public function applyOn(): string { - return Declarations::ACTIVITY_ACP; + return Declarations::ACTIVITY_ACP; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_sentreceived', ChoiceType::class, [ + 'choices' => self::CHOICES, + 'multiple' => false, + 'expanded' => true, + 'empty_data' => self::DEFAULT_CHOICE, + 'data' => self::DEFAULT_CHOICE, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $sentreceived = array_flip(self::CHOICES)[$data['accepted_sentreceived']]; + + return ['Filtered activity by sentreceived: only %sentreceived%', [ + '%sentreceived%' => $this->translator->trans($sentreceived), + ]]; + } + + public function getTitle(): string + { + return 'Filter activity by sentreceived'; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php index d1455ea89..ef865b3a8 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php @@ -1,12 +1,19 @@ userRender = $userRender; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_users', EntityType::class, [ - 'class' => User::class, - 'choice_label' => function (User $u) { - return $this->userRender->renderString($u, []); - }, - 'multiple' => true, - 'expanded' => true, - 'label' => 'Creators' - ]); - } - - public function getTitle(): string - { - return 'Filter activity by user'; - } - - public function describeAction($data, $format = 'string'): array - { - $users = []; - - foreach ($data['accepted_users'] as $u) { - $users[] = $this->userRender->renderString($u, []); - } - - return ['Filtered activity by user: only %users%', [ - '%users%' => implode(", ou ", $users) - ]]; - } - public function addRole() { return null; @@ -74,9 +50,39 @@ class UserFilter implements FilterInterface $qb->setParameter('users', $data['accepted_users']); } - public function applyOn(): string + public function applyOn(): string { - return Declarations::ACTIVITY_ACP; + return Declarations::ACTIVITY_ACP; } -} \ No newline at end of file + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_users', EntityType::class, [ + 'class' => User::class, + 'choice_label' => function (User $u) { + return $this->userRender->renderString($u, []); + }, + 'multiple' => true, + 'expanded' => true, + 'label' => 'Creators', + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $users = []; + + foreach ($data['accepted_users'] as $u) { + $users[] = $this->userRender->renderString($u, []); + } + + return ['Filtered activity by user: only %users%', [ + '%users%' => implode(', ou ', $users), + ]]; + } + + public function getTitle(): string + { + return 'Filter activity by user'; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php index 987704ab8..ae2ad2629 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php @@ -1,17 +1,25 @@ translatableStringHelper = $translatableStringHelper; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_userscope', EntityType::class, [ - 'class' => Scope::class, - 'choice_label' => function (Scope $s) { - return $this->translatableStringHelper->localize( - $s->getName() - ); - }, - 'multiple' => true, - 'expanded' => true - ]); - } - - public function getTitle(): string - { - return 'Filter activity by userscope'; - } - - public function describeAction($data, $format = 'string'): array - { - $scopes = []; - - foreach ($data['accepted_userscope'] as $s) { - $scopes[] = $this->translatableStringHelper->localize( - $s->getName() - ); - } - - return ['Filtered activity by userscope: only %scopes%', [ - '%scopes%' => implode(", ou ", $scopes) - ]]; - } - public function addRole() { return null; @@ -63,7 +37,7 @@ class UserScopeFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('user', $qb->getAllAliases())) { + if (!in_array('user', $qb->getAllAliases(), true)) { $qb->join('activity.user', 'user'); } @@ -81,9 +55,42 @@ class UserScopeFilter implements FilterInterface $qb->setParameter('userscope', $data['accepted_userscope']); } - public function applyOn(): string + public function applyOn(): string { - return Declarations::ACTIVITY_ACP; + return Declarations::ACTIVITY_ACP; } -} \ No newline at end of file + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_userscope', EntityType::class, [ + 'class' => Scope::class, + 'choice_label' => function (Scope $s) { + return $this->translatableStringHelper->localize( + $s->getName() + ); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $scopes = []; + + foreach ($data['accepted_userscope'] as $s) { + $scopes[] = $this->translatableStringHelper->localize( + $s->getName() + ); + } + + return ['Filtered activity by userscope: only %scopes%', [ + '%scopes%' => implode(', ou ', $scopes), + ]]; + } + + public function getTitle(): string + { + return 'Filter activity by userscope'; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php index 4b20553af..65057cb1e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php @@ -73,8 +73,7 @@ class ActivityDateFilter implements FilterInterface ->add('date_to', ChillDateType::class, [ 'label' => 'Activities before this date', 'data' => new DateTime(), - ]) - ; + ]); $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { /** @var \Symfony\Component\Form\FormInterface $filterForm */ diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php index ed7c265ff..af96dd474 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php @@ -1,20 +1,30 @@ groupBy('agent_aggregator'); } - } public function applyOn(): string @@ -54,7 +63,7 @@ final class AgentAggregator implements AggregatorInterface // no form } - public function getLabels($key, array $values, $data): \Closure + public function getLabels($key, array $values, $data): Closure { return function ($value): string { if ('_header' === $value) { @@ -76,4 +85,4 @@ final class AgentAggregator implements AggregatorInterface { return 'Group by agent'; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php index 583153a7d..2010fb90c 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php @@ -1,11 +1,21 @@ translatableStringHelper = $translatableStringHelper; } - public function getLabels($key, array $values, $data): \Closure - { - return function($value): string { - if ($value === '_header') { - return 'Cancel reason'; - } - - $j = $this->cancelReasonRepository->find($value); - - return $this->translatableStringHelper->localize( - $j->getName() - ); - }; - } - - public function getQueryKeys($data): array - { - return ['cancel_reason_aggregator']; - } - - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - public function getTitle(): string - { - return 'Group by cancel reason'; - } - public function addRole() { return null; @@ -78,4 +58,34 @@ class CancelReasonAggregator implements AggregatorInterface { return Declarations::CALENDAR_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data): Closure + { + return function ($value): string { + if ('_header' === $value) { + return 'Cancel reason'; + } + + $j = $this->cancelReasonRepository->find($value); + + return $this->translatableStringHelper->localize( + $j->getName() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['cancel_reason_aggregator']; + } + + public function getTitle(): string + { + return 'Group by cancel reason'; + } +} diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php index b019cc21b..a2b300f24 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php @@ -1,11 +1,21 @@ translatableStringHelper = $translatableStringHelper; } - public function getLabels($key, array $values, $data): \Closure - { - return function($value): string { - if ($value === '_header') { - return 'Job'; - } - - $j = $this->jobRepository->find($value); - - return $this->translatableStringHelper->localize( - $j->getLabel() - ); - }; - } - - public function getQueryKeys($data): array - { - return ['job_aggregator']; - } - - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - public function getTitle(): string - { - return 'Group by agent job'; - } - public function addRole() { return null; @@ -77,4 +57,34 @@ final class JobAggregator implements AggregatorInterface { return Declarations::CALENDAR_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data): Closure + { + return function ($value): string { + if ('_header' === $value) { + return 'Job'; + } + + $j = $this->jobRepository->find($value); + + return $this->translatableStringHelper->localize( + $j->getLabel() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['job_aggregator']; + } + + public function getTitle(): string + { + return 'Group by agent job'; + } +} diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php index bc921c9c7..6d5a6476d 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php @@ -1,10 +1,20 @@ locationRepository = $locationRepository; } - public function getLabels($key, array $values, $data): \Closure - { - return function($value): string { - if ($value === '_header') { - return 'Location'; - } - - $l = $this->locationRepository->find($value); - - return $l->getName(); - - }; - } - - public function getQueryKeys($data): array - { - return ['location_aggregator']; - } - - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - public function getTitle(): string - { - return 'Group by location'; - } - public function addRole(): ?Role { return null; @@ -72,4 +53,31 @@ final class LocationAggregator implements AggregatorInterface return Declarations::CALENDAR_TYPE; } -} \ No newline at end of file + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data): Closure + { + return function ($value): string { + if ('_header' === $value) { + return 'Location'; + } + + $l = $this->locationRepository->find($value); + + return $l->getName(); + }; + } + + public function getQueryKeys($data): array + { + return ['location_aggregator']; + } + + public function getTitle(): string + { + return 'Group by location'; + } +} diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php index 3b3b9105a..4ead075d5 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php @@ -1,11 +1,21 @@ translatableStringHelper = $translatableStringHelper; } - public function getLabels($key, array $values, $data): \Closure - { - return function($value): string { - if ($value === '_header') { - return 'Location type'; - } - - $j = $this->locationTypeRepository->find($value); - - return $this->translatableStringHelper->localize( - $j->getTitle() - ); - }; - } - - public function getQueryKeys($data): array - { - return ['location_type_aggregator']; - } - - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - public function getTitle(): string - { - return 'Group by location type'; - } - public function addRole() { return null; @@ -78,4 +58,33 @@ final class LocationTypeAggregator implements AggregatorInterface return Declarations::CALENDAR_TYPE; } -} \ No newline at end of file + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data): Closure + { + return function ($value): string { + if ('_header' === $value) { + return 'Location type'; + } + + $j = $this->locationTypeRepository->find($value); + + return $this->translatableStringHelper->localize( + $j->getTitle() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['location_type_aggregator']; + } + + public function getTitle(): string + { + return 'Group by location type'; + } +} diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php index 71a0e75bb..42bac218d 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php @@ -1,5 +1,14 @@ translatableStringHelper = $translatableStringHelper; } - public function getLabels($key, array $values, $data): \Closure - { - return function ($value): string { - if ($value === '_header') { - return 'Scope'; - } - - $s = $this->scopeRepository->find($value); - - return $this->translatableStringHelper->localize( - $s->getName() - ); - }; - } - - public function getQueryKeys($data): array - { - return ['scope_aggregator']; - } - - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - public function getTitle(): string - { - return 'Group by agent scope'; - } - public function addRole() { return null; @@ -77,4 +57,34 @@ final class ScopeAggregator implements AggregatorInterface { return Declarations::CALENDAR_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data): Closure + { + return function ($value): string { + if ('_header' === $value) { + return 'Scope'; + } + + $s = $this->scopeRepository->find($value); + + return $this->translatableStringHelper->localize( + $s->getName() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['scope_aggregator']; + } + + public function getTitle(): string + { + return 'Group by agent scope'; + } +} diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/CountAppointments.php b/src/Bundle/ChillCalendarBundle/Export/Export/CountAppointments.php index e47288edc..36864e92e 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/CountAppointments.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/CountAppointments.php @@ -1,13 +1,23 @@ getQuery()->getResult(Query::HYDRATE_SCALAR); } + public function getTitle(): string + { + return 'Average appointment duration'; + } + public function getType(): string { return Declarations::CALENDAR_TYPE; @@ -91,13 +105,7 @@ class StatAppointmentAvgDuration implements ExportInterface, GroupedExportInterf public function supportsModifiers(): array { return [ - Declarations::CALENDAR_TYPE + Declarations::CALENDAR_TYPE, ]; } - - public function getGroup(): string - { - return 'Exports of calendar'; - } - -} \ No newline at end of file +} diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentSumDuration.php b/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentSumDuration.php index 0e362d766..1960af2e4 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentSumDuration.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentSumDuration.php @@ -1,5 +1,14 @@ getQuery()->getResult(Query::HYDRATE_SCALAR); } + public function getTitle(): string + { + return 'Sum of appointment durations'; + } + public function getType(): string { return Declarations::CALENDAR_TYPE; @@ -90,13 +105,7 @@ class StatAppointmentSumDuration implements ExportInterface, GroupedExportInterf public function supportsModifiers(): array { return [ - Declarations::CALENDAR_TYPE + Declarations::CALENDAR_TYPE, ]; } - - public function getGroup(): string - { - return 'Exports of calendar'; - } - -} \ No newline at end of file +} diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php index 5c16d0728..ee4e82350 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php @@ -1,5 +1,14 @@ userRender = $userRender; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_agents', EntityType::class, [ - 'class' => User::class, - 'choice_label' => function (User $u) { - return $this->userRender->renderString($u, []); - }, - 'multiple' => true, - 'expanded' => true - ]); - - } - - public function getTitle(): string - { - return 'Filter by agent'; - } - - public function describeAction($data, $format = 'string'): array - { - $users = []; - - foreach ($data['accepted_agents'] as $r) { - $users[] = $r; - } - - return [ - 'Filtered by agent: only %agents%', [ - '%agents' => implode(", ou ", $users) - ]]; - } - public function addRole() { return null; @@ -76,4 +53,35 @@ class AgentFilter implements FilterInterface { return Declarations::CALENDAR_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_agents', EntityType::class, [ + 'class' => User::class, + 'choice_label' => function (User $u) { + return $this->userRender->renderString($u, []); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $users = []; + + foreach ($data['accepted_agents'] as $r) { + $users[] = $r; + } + + return [ + 'Filtered by agent: only %agents%', [ + '%agents' => implode(', ou ', $users), + ], ]; + } + + public function getTitle(): string + { + return 'Filter by agent'; + } +} diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php index a23c76d98..74b481abe 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php @@ -1,42 +1,26 @@ add('date_from', ChillDateType::class, [ - 'data' => new \DateTime(), - ]) - ->add('date_to', ChillDateType::class, [ - 'data' => new \DateTime(), - ]) - ; - } - - public function getTitle(): string - { - return 'Filter by appointments between certain dates'; - } - - public function describeAction($data, $format = 'string'): array - { - return ['Filtered by appointments between %dateFrom% and %dateTo%', [ - '%dateFrom%' => $data['date_from']->format('d-m-Y'), - '%dateTo%' => $data['date_to']->format('d-m-Y'), - ]]; - } - public function addRole() { return null; @@ -47,9 +31,9 @@ class BetweenDatesFilter implements FilterInterface $where = $qb->getDQLPart('where'); $clause = $qb->expr()->andX( - $qb->expr()->gte('cal.startDate', ':dateFrom'), - $qb->expr()->lte('cal.endDate', ':dateTo') - ); + $qb->expr()->gte('cal.startDate', ':dateFrom'), + $qb->expr()->lte('cal.endDate', ':dateTo') + ); if ($where instanceof Andx) { $where->add($clause); @@ -67,4 +51,28 @@ class BetweenDatesFilter implements FilterInterface { return Declarations::CALENDAR_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('date_from', ChillDateType::class, [ + 'data' => new DateTime(), + ]) + ->add('date_to', ChillDateType::class, [ + 'data' => new DateTime(), + ]); + } + + public function describeAction($data, $format = 'string'): array + { + return ['Filtered by appointments between %dateFrom% and %dateTo%', [ + '%dateFrom%' => $data['date_from']->format('d-m-Y'), + '%dateTo%' => $data['date_to']->format('d-m-Y'), + ]]; + } + + public function getTitle(): string + { + return 'Filter by appointments between certain dates'; + } +} diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php index 42e03e239..562c3281e 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php @@ -23,7 +23,6 @@ use Symfony\Contracts\Translation\TranslatorInterface; class JobFilter implements FilterInterface { - protected TranslatorInterface $translator; private TranslatableStringHelper $translatableStringHelper; @@ -36,34 +35,6 @@ class JobFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('job', EntityType::class, [ - 'class' => UserJob::class, - 'choice_label' => function (UserJob $j) { - return $this->translatableStringHelper->localize( - $j->getLabel() - ); - }, - 'multiple' => true, - 'expanded' => true - ]); - } - - public function describeAction($data, $format = 'string'): array - { - $userJobs = []; - - foreach ($data['job'] as $j) { - $userJobs[] = $this->translatableStringHelper->localize( - $j->getLabel()); - } - - return ['Filtered by agent job: only %jobs%', [ - '%jobs%' => implode(', ou ', $userJobs) - ]]; - } - public function addRole() { return null; @@ -91,6 +62,34 @@ class JobFilter implements FilterInterface return Declarations::CALENDAR_TYPE; } + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('job', EntityType::class, [ + 'class' => UserJob::class, + 'choice_label' => function (UserJob $j) { + return $this->translatableStringHelper->localize( + $j->getLabel() + ); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $userJobs = []; + + foreach ($data['job'] as $j) { + $userJobs[] = $this->translatableStringHelper->localize( + $j->getLabel() + ); + } + + return ['Filtered by agent job: only %jobs%', [ + '%jobs%' => implode(', ou ', $userJobs), + ]]; + } public function getTitle(): string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php index c3fc7b1e4..3ac1d0f1b 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php @@ -23,7 +23,6 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ScopeFilter implements FilterInterface { - protected TranslatorInterface $translator; private TranslatableStringHelper $translatableStringHelper; @@ -36,34 +35,6 @@ class ScopeFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('scope', EntityType::class, [ - 'class' => Scope::class, - 'choice_label' => function (Scope $s) { - return $this->translatableStringHelper->localize( - $s->getName() - ); - }, - 'multiple' => true, - 'expanded' => true - ]); - } - - public function describeAction($data, $format = 'string') - { - $scopes = []; - - foreach ($data['scope'] as $s) { - $scopes[] = $this->translatableStringHelper->localize( - $s->getName()); - } - - return ['Filtered by agent scope: only %scopes%', [ - '%scopes%' => implode(', ou ', $scopes) - ]]; - } - public function addRole() { return null; @@ -91,9 +62,37 @@ class ScopeFilter implements FilterInterface return Declarations::CALENDAR_TYPE; } + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('scope', EntityType::class, [ + 'class' => Scope::class, + 'choice_label' => function (Scope $s) { + return $this->translatableStringHelper->localize( + $s->getName() + ); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string') + { + $scopes = []; + + foreach ($data['scope'] as $s) { + $scopes[] = $this->translatableStringHelper->localize( + $s->getName() + ); + } + + return ['Filtered by agent scope: only %scopes%', [ + '%scopes%' => implode(', ou ', $scopes), + ]]; + } public function getTitle() { return 'Filter by agent scope'; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillMainBundle/Controller/ExportController.php b/src/Bundle/ChillMainBundle/Controller/ExportController.php index a7404b879..1893a64b3 100644 --- a/src/Bundle/ChillMainBundle/Controller/ExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/ExportController.php @@ -525,6 +525,21 @@ class ExportController extends AbstractController ); } + private function getExportGroup($target): string + { + $exportManager = $this->exportManager; + + $groups = $exportManager->getExportsGrouped(true); + + foreach ($groups as $group => $array) { + foreach ($array as $alias => $export) { + if ($export === $target) { + return $group; + } + } + } + } + /** * get the next step. If $reverse === true, the previous step is returned. * @@ -572,19 +587,4 @@ class ExportController extends AbstractController throw new LogicException("the step {$step} is not defined."); } } - - private function getExportGroup($target): string - { - $exportManager = $this->exportManager; - - $groups = $exportManager->getExportsGrouped(true); - - foreach ($groups as $group => $array) { - foreach ($array as $alias => $export) { - if ($export === $target) { - return $group; - } - } - } - } } diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/Extract.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/Extract.php index 72ca2b461..7d8809582 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/DQL/Extract.php +++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/Extract.php @@ -1,10 +1,18 @@ EXTRACT(field FROM interval) @@ -50,5 +58,4 @@ class Extract extends FunctionNode $parser->match(Lexer::T_CLOSE_PARENTHESIS); } - -} \ No newline at end of file +} diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/ToChar.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/ToChar.php index c634555dc..51ff5a9dd 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/DQL/ToChar.php +++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/ToChar.php @@ -1,5 +1,14 @@ fmt = $parser->StringExpression(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); } - -} \ No newline at end of file +} diff --git a/src/Bundle/ChillMainBundle/migrations/Version20220829132409.php b/src/Bundle/ChillMainBundle/migrations/Version20220829132409.php index 0bb09ef74..0da81d182 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20220829132409.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20220829132409.php @@ -1,5 +1,12 @@ addSql('DROP SEQUENCE chill_main_geographical_unit_id_seq CASCADE'); + $this->addSql('DROP TABLE chill_main_geographical_unit'); + } + public function getDescription(): string { return 'Add new entity GeographicalUnit'; @@ -22,10 +35,4 @@ final class Version20220829132409 extends AbstractMigration $this->addSql('CREATE SEQUENCE chill_main_geographical_unit_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); $this->addSql('CREATE TABLE chill_main_geographical_unit (id INT NOT NULL, geom TEXT DEFAULT NULL, layerName VARCHAR(255) DEFAULT NULL, unitName VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))'); } - - public function down(Schema $schema): void - { - $this->addSql('DROP SEQUENCE chill_main_geographical_unit_id_seq CASCADE'); - $this->addSql('DROP TABLE chill_main_geographical_unit'); - } } diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionTypeController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionTypeController.php index eb1dc1ea9..e7fc5b203 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionTypeController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionTypeController.php @@ -23,4 +23,4 @@ class HouseholdCompositionTypeController extends CRUDController return parent::orderQuery($action, $query, $request, $paginator); } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index efbb972c1..47b414ce2 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -95,6 +95,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac $loader->load('services/accompanyingPeriodConsistency.yaml'); $loader->load('services/exports_person.yaml'); + if ($container->getParameter('chill_person.accompanying_period') !== 'hidden') { $loader->load('services/exports_accompanying_period.yaml'); } diff --git a/src/Bundle/ChillPersonBundle/Entity/MaritalStatus.php b/src/Bundle/ChillPersonBundle/Entity/MaritalStatus.php index 649830b4a..05f47ffcf 100644 --- a/src/Bundle/ChillPersonBundle/Entity/MaritalStatus.php +++ b/src/Bundle/ChillPersonBundle/Entity/MaritalStatus.php @@ -31,7 +31,6 @@ class MaritalStatus private ?string $id; /** - * @var array * @ORM\Column(type="json") */ private array $name; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php index 8d421f369..69d1b265d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php @@ -1,8 +1,16 @@ translatableStringHelper = $translatableStringHelper; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ('_header' === $value) { - return 'Administrative location'; - } - - $l = $this->locationRepository->find($value); - - return $l->getName() .' ('. $this->translatableStringHelper->localize($l->getLocationType()->getTitle()) . ')'; - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data): array - { - return ['location_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - /** - * @inheritDoc - */ - public function getTitle() - { - return 'Group by administrative location'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $qb->join('acp.administrativeLocation', 'al'); @@ -90,11 +52,36 @@ class AdministrativeLocationAggregator implements AggregatorInterface } } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Administrative location'; + } + + $l = $this->locationRepository->find($value); + + return $l->getName() . ' (' . $this->translatableStringHelper->localize($l->getLocationType()->getTitle()) . ')'; + }; + } + + public function getQueryKeys($data): array + { + return ['location_aggregator']; + } + + public function getTitle() + { + return 'Group by administrative location'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php index 198cacea7..d525f2f9b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php @@ -1,12 +1,20 @@ translatableStringHelper = $translatableStringHelper; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ('_header' === $value) { - return 'Closing motive'; - } - - $cm = $this->motiveRepository->find($value); - - return $this->translatableStringHelper->localize( - $cm->getName() - ); - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data) - { - return ['closingmotive_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Group by closing motive'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $qb->join('acp.closingMotive', 'cm'); @@ -93,11 +53,38 @@ class ClosingMotiveAggregator implements AggregatorInterface } } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Closing motive'; + } + + $cm = $this->motiveRepository->find($value); + + return $this->translatableStringHelper->localize( + $cm->getName() + ); + }; + } + + public function getQueryKeys($data) + { + return ['closingmotive_aggregator']; + } + + public function getTitle(): string + { + return 'Group by closing motive'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php index d2bec5c32..534ef268a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php @@ -1,5 +1,14 @@ translator = $translator; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ($value === '_header') { - return 'Confidentiality'; - } - switch ($value) { - - case true: - return $this->translator->trans('is confidential'); - - case false: - return $this->translator->trans('is not confidential'); - - default: - throw new LogicException(sprintf('The value %s is not valid', $value)); - } - return $value; - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data): array - { - return ['confidential_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Group by confidential'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $qb->addSelect('acp.confidential AS confidential_aggregator'); @@ -90,11 +45,45 @@ class ConfidentialAggregator implements AggregatorInterface } } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Confidentiality'; + } + + switch ($value) { + case true: + return $this->translator->trans('is confidential'); + + case false: + return $this->translator->trans('is not confidential'); + + default: + throw new LogicException(sprintf('The value %s is not valid', $value)); + } + + return $value; + }; + } + + public function getQueryKeys($data): array + { + return ['confidential_aggregator']; + } + + public function getTitle(): string + { + return 'Group by confidential'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php index 2a0215e82..ba6a1d3df 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php @@ -1,14 +1,19 @@ translator = $translator; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function ($value) use ($data): string { - - if ($value === '_header') { - return $this->translator->trans('Rounded month duration'); - } - - if ($value === null) { - return $this->translator->trans('current duration'); // when closingDate is null - } - - if ($value === 0) { - return $this->translator->trans("duration 0 month"); - } - - return ''. $value . $this->translator->trans(' months'); - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data): array - { - return ['duration_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Group by duration'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $qb // OUI - ->addSelect(' - (acp.closingDate - acp.openingDate +15) *12/365 + ->addSelect( + ' + (acp.closingDate - acp.openingDate +15) *12/365 AS duration_aggregator' ) //->addSelect('DATE_DIFF(acp.closingDate, acp.openingDate) AS duration_aggregator') @@ -124,8 +77,8 @@ class DurationAggregator implements AggregatorInterface ELSE EXTRACT(month FROM DATE_DIFF(acp.closingDate, acp.openingDate)) END ) AS duration_aggregator ') - */ - ; + */ +; $groupBy = $qb->getDQLPart('groupBy'); @@ -138,11 +91,42 @@ class DurationAggregator implements AggregatorInterface $qb->orderBy('duration_aggregator'); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return $this->translator->trans('Rounded month duration'); + } + + if (null === $value) { + return $this->translator->trans('current duration'); // when closingDate is null + } + + if (0 === $value) { + return $this->translator->trans('duration 0 month'); + } + + return '' . $value . $this->translator->trans(' months'); + }; + } + + public function getQueryKeys($data): array + { + return ['duration_aggregator']; + } + + public function getTitle(): string + { + return 'Group by duration'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php index c5991e7f0..4bee25a39 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php @@ -1,5 +1,14 @@ translator = $translator; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ($value === '_header') { - return 'Emergency'; - } - switch ($value) { - - case true: - return $this->translator->trans('is emergency'); - - case false: - return $this->translator->trans('is not emergency'); - - default: - throw new LogicException(sprintf('The value %s is not valid', $value)); - } - return $value; - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data): array - { - return ['emergency_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Group by emergency'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $qb->addSelect('acp.emergency AS emergency_aggregator'); @@ -90,11 +45,45 @@ class EmergencyAggregator implements AggregatorInterface } } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Emergency'; + } + + switch ($value) { + case true: + return $this->translator->trans('is emergency'); + + case false: + return $this->translator->trans('is not emergency'); + + default: + throw new LogicException(sprintf('The value %s is not valid', $value)); + } + + return $value; + }; + } + + public function getQueryKeys($data): array + { + return ['emergency_aggregator']; + } + + public function getTitle(): string + { + return 'Group by emergency'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php index 3f98c7003..4c9fefe31 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php @@ -1,5 +1,14 @@ translatableStringHelper = $translatableStringHelper; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ('_header' === $value) { - return 'Evaluation'; - } - - $e = $this->evaluationRepository->find($value); - - return $this->translatableStringHelper->localize( - $e->getTitle() - ); - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data): array - { - return ['evaluation_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Group by evaluation'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('acpw', $qb->getAllAliases())) { + if (!in_array('acpw', $qb->getAllAliases(), true)) { $qb->join('acp.works', 'acpw'); } $qb->join('acpw.accompanyingPeriodWorkEvaluations', 'we'); @@ -94,11 +56,38 @@ final class EvaluationAggregator implements AggregatorInterface } } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Evaluation'; + } + + $e = $this->evaluationRepository->find($value); + + return $this->translatableStringHelper->localize( + $e->getTitle() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['evaluation_aggregator']; + } + + public function getTitle(): string + { + return 'Group by evaluation'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php index 8da38b766..5962654c0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php @@ -1,5 +1,14 @@ translator = $translator; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ($value === '_header') { - return 'Intensity'; - } - switch ($value) { - case 'occasional': - return $this->translator->trans('is occasional'); - case 'regular': - return $this->translator->trans('is regular'); - default: - throw new LogicException(sprintf('The value %s is not valid', $value)); - } - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data): array - { - return ['intensity_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Group by intensity'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $qb->addSelect('acp.intensity AS intensity_aggregator'); @@ -86,11 +45,43 @@ class IntensityAggregator implements AggregatorInterface } } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Intensity'; + } + + switch ($value) { + case 'occasional': + return $this->translator->trans('is occasional'); + + case 'regular': + return $this->translator->trans('is regular'); + + default: + throw new LogicException(sprintf('The value %s is not valid', $value)); + } + }; + } + + public function getQueryKeys($data): array + { + return ['intensity_aggregator']; + } + + public function getTitle(): string + { + return 'Group by intensity'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php index 31b3fca66..c5c9c3180 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php @@ -1,18 +1,25 @@ translatableStringHelper = $translatableStringHelper; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function($value): string { - if ($value === '_header') { - return 'Job'; - } - - $j = $this->jobRepository->find($value); - - return $this->translatableStringHelper->localize( - $j->getLabel() - ); - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data): array - { - return ['job_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Group by user job'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $qb->join('acp.job', 'j'); @@ -93,11 +52,38 @@ final class JobAggregator implements AggregatorInterface } } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Job'; + } + + $j = $this->jobRepository->find($value); + + return $this->translatableStringHelper->localize( + $j->getLabel() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['job_aggregator']; + } + + public function getTitle(): string + { + return 'Group by user job'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php index 2bb131435..7c4ad76fd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php @@ -1,5 +1,14 @@ translatableStringHelper = $translatableStringHelper; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ('_header' === $value) { - return 'Origin'; - } - - $o = $this->repository->find($value); - - return $this->translatableStringHelper->localize( - $o->getLabel() - ); - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data): array - { - return ['origin_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Group by origin'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $qb->join('acp.origin', 'o'); @@ -93,11 +54,38 @@ final class OriginAggregator implements AggregatorInterface } } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Origin'; + } + + $o = $this->repository->find($value); + + return $this->translatableStringHelper->localize( + $o->getLabel() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['origin_aggregator']; + } + + public function getTitle(): string + { + return 'Group by origin'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php index 56522f2ed..323a17e26 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php @@ -15,16 +15,15 @@ use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Repository\UserRepository; use Chill\MainBundle\Templating\Entity\UserRender; use Chill\PersonBundle\Export\Declarations; -use Doctrine\ORM\Query\Expr\From; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; final class ReferrerAggregator implements AggregatorInterface { - private UserRepository $userRepository; - private UserRender $userRender; + private UserRepository $userRepository; + public function __construct( UserRepository $userRepository, UserRender $userRender @@ -51,7 +50,6 @@ final class ReferrerAggregator implements AggregatorInterface } else { $qb->groupBy('referrer_aggregator'); } - } public function applyOn(): string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php index 5bddac42b..46187d558 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php @@ -1,18 +1,25 @@ translatableStringHelper = $translatableStringHelper; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ($value === '_header') { - return 'Scope'; - } - - $s = $this->scopeRepository->find($value); - - return $this->translatableStringHelper->localize( - $s->getName() - ); - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data): array - { - return ['scope_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Group by user scope'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $qb->join('acp.scopes', 's'); @@ -93,11 +52,38 @@ final class ScopeAggregator implements AggregatorInterface } } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Scope'; + } + + $s = $this->scopeRepository->find($value); + + return $this->translatableStringHelper->localize( + $s->getName() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['scope_aggregator']; + } + + public function getTitle(): string + { + return 'Group by user scope'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php index a9257bd8e..f28cd559b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php @@ -1,5 +1,14 @@ actionRepository = $actionRepository; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function($value) { - if ('_header' === $value) { - return 'Social action'; - } - - $sa = $this->actionRepository->find($value); - - return $this->actionRender->renderString($sa, []); - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data): array - { - return ['socialaction_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Group by social action'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('acpw', $qb->getAllAliases())) { + if (!in_array('acpw', $qb->getAllAliases(), true)) { $qb->join('acp.works', 'acpw'); } @@ -91,11 +55,36 @@ final class SocialActionAggregator implements AggregatorInterface } } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value) { + if ('_header' === $value) { + return 'Social action'; + } + + $sa = $this->actionRepository->find($value); + + return $this->actionRender->renderString($sa, []); + }; + } + + public function getQueryKeys($data): array + { + return ['socialaction_aggregator']; + } + + public function getTitle(): string + { + return 'Group by social action'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php index fe2830d00..362d8e666 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php @@ -1,5 +1,14 @@ issueRender = $issueRender; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function ($value): string { - - if ($value === '_header') { - return 'Social issues'; - } - - $i = $this->issueRepository->find($value); - - return $this->issueRender->renderString($i, []); - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data): array - { - return ['socialissue_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Group by social issue'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $qb->join('acp.socialIssues', 'si'); @@ -90,11 +51,36 @@ final class SocialIssueAggregator implements AggregatorInterface } } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Social issues'; + } + + $i = $this->issueRepository->find($value); + + return $this->issueRender->renderString($i, []); + }; + } + + public function getQueryKeys($data): array + { + return ['socialissue_aggregator']; + } + + public function getTitle(): string + { + return 'Group by social issue'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php index 9b21373a8..7d3423a04 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php @@ -1,5 +1,14 @@ translator = $translator; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function ($value): string { - switch ($value) { - - case AccompanyingPeriod::STEP_DRAFT: - return $this->translator->trans('Draft'); - - case AccompanyingPeriod::STEP_CONFIRMED: - return $this->translator->trans('Confirmed'); - - case AccompanyingPeriod::STEP_CLOSED: - return $this->translator->trans('Closed'); - - case '_header': - return 'Step'; - - default: - throw new LogicException(sprintf('The value %s is not valid', $value)); - } - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data): array - { - return ['step_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('on_date', ChillDateType::class, [ - 'data' => new \DateTime(), - ]); - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Group by step'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $qb->addSelect('acp.step AS step_aggregator'); @@ -119,14 +71,50 @@ final class StepAggregator implements AggregatorInterface //, FilterInterface $qb->setParameter('ondate', $data['on_date'], Types::DATE_MUTABLE); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('on_date', ChillDateType::class, [ + 'data' => new DateTime(), + ]); + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + switch ($value) { + case AccompanyingPeriod::STEP_DRAFT: + return $this->translator->trans('Draft'); + + case AccompanyingPeriod::STEP_CONFIRMED: + return $this->translator->trans('Confirmed'); + + case AccompanyingPeriod::STEP_CLOSED: + return $this->translator->trans('Closed'); + + case '_header': + return 'Step'; + + default: + throw new LogicException(sprintf('The value %s is not valid', $value)); + } + }; + } + + public function getQueryKeys($data): array + { + return ['step_aggregator']; + } + + public function getTitle(): string + { + return 'Group by step'; + } + /* * TODO check if we need to add FilterInterface and DescribeAction Method to describe date filter ?? * @@ -138,5 +126,5 @@ final class StepAggregator implements AggregatorInterface //, FilterInterface ] ]; } - */ -} \ No newline at end of file + */ +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php index e94290925..6c20ae548 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php @@ -1,5 +1,14 @@ translatableStringHelper = $translatableStringHelper; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ($value === '_header') { - return 'Evaluation type'; - } - - $ev = $this->evaluationRepository->find($value); - - return $this->translatableStringHelper->localize($ev->getTitle()); - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data): array - { - return ['evaluationtype_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Group by evaluation type'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $qb->addSelect('IDENTITY(eval.evaluation) AS evaluationtype_aggregator'); @@ -87,11 +50,36 @@ class EvaluationTypeAggregator implements AggregatorInterface } } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::EVAL_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Evaluation type'; + } + + $ev = $this->evaluationRepository->find($value); + + return $this->translatableStringHelper->localize($ev->getTitle()); + }; + } + + public function getQueryKeys($data): array + { + return ['evaluationtype_aggregator']; + } + + public function getTitle(): string + { + return 'Group by evaluation type'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php index df50b76f0..417941a04 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php @@ -1,13 +1,24 @@ translator = $translator; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function ($value): string { - - if ($value === '_header') { - return 'Number of children'; - } - - return $this->translator->trans( - 'household_composition.numberOfChildren children in household', [ - 'numberOfChildren' => $value - ]); - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data): array - { - return ['childrennumber_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('on_date', ChillDateType::class, [ - 'data' => new \DateTime('now'), - ]); - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Group by number of children'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('composition', $qb->getAllAliases())) { + if (!in_array('composition', $qb->getAllAliases(), true)) { $qb->join('household.compositions', 'composition'); } @@ -102,11 +63,41 @@ class ChildrenNumberAggregator implements AggregatorInterface ); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::HOUSEHOLD_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('on_date', ChillDateType::class, [ + 'data' => new DateTime('now'), + ]); + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Number of children'; + } + + return $this->translator->trans( + 'household_composition.numberOfChildren children in household', + [ + 'numberOfChildren' => $value, + ] + ); + }; + } + + public function getQueryKeys($data): array + { + return ['childrennumber_aggregator']; + } + + public function getTitle(): string + { + return 'Group by number of children'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php index 2c6ab174f..429431af6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php @@ -1,5 +1,14 @@ translatableStringHelper = $translatableStringHelper; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ($value === '_header') { - return 'Composition'; - } - - $c = $this->typeRepository->find($value); - - return $this->translatableStringHelper->localize( - $c->getLabel() - ); - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data): array - { - return ['composition_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('on_date', ChillDateType::class, [ - 'data' => new \DateTime('now'), - ]); - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Group by composition'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('composition', $qb->getAllAliases())) { + if (!in_array('composition', $qb->getAllAliases(), true)) { $qb->join('household.compositions', 'composition'); } @@ -118,11 +79,40 @@ class CompositionAggregator implements AggregatorInterface $qb->setParameter('ondate', $data['on_date'], Types::DATE_MUTABLE); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::HOUSEHOLD_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('on_date', ChillDateType::class, [ + 'data' => new DateTime('now'), + ]); + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Composition'; + } + + $c = $this->typeRepository->find($value); + + return $this->translatableStringHelper->localize( + $c->getLabel() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['composition_aggregator']; + } + + public function getTitle(): string + { + return 'Group by composition'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php index ec4a270ac..872b3f9f5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php @@ -18,19 +18,18 @@ use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Repository\Household\PositionRepository; use DateTime; use Doctrine\ORM\QueryBuilder; -use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Contracts\Translation\TranslatorInterface; final class HouseholdPositionAggregator implements AggregatorInterface, ExportElementValidatedInterface { - private TranslatorInterface $translator; - private PositionRepository $positionRepository; private TranslatableStringHelper $translatableStringHelper; + private TranslatorInterface $translator; + public function __construct(TranslatorInterface $translator, TranslatableStringHelper $translatableStringHelper, PositionRepository $positionRepository) { $this->translator = $translator; @@ -70,7 +69,6 @@ final class HouseholdPositionAggregator implements AggregatorInterface, ExportEl } else { $qb->groupBy('household_position_aggregator'); } - } public function applyOn() diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php index 3d4c1f7cd..4a9534a6d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php @@ -18,7 +18,6 @@ use Chill\PersonBundle\Repository\MaritalStatusRepository; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; - final class MaritalStatusAggregator implements AggregatorInterface { private MaritalStatusRepository $maritalStatusRepository; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php index 8c3c0e9a7..fcae239cb 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php @@ -124,19 +124,17 @@ final class NationalityAggregator implements AggregatorInterface, ExportElementV ->getQuery() ->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR); - // initialize array and add blank key for null values $labels = [ '' => $this->translator->trans('without data'), '_header' => $this->translator->trans('Nationality'), ]; - foreach ($countries as $row) { $labels[$row['c_countryCode']] = $this->translatableStringHelper->localize($row['c_name']); } } - + if ('continent' === $data['group_by_level']) { $labels = [ 'EU' => $this->translator->trans('Europe'), @@ -151,10 +149,9 @@ final class NationalityAggregator implements AggregatorInterface, ExportElementV ]; } - return function ($value) use ($labels): string { + return static function ($value) use ($labels): string { return $labels[$value]; }; - } public function getQueryKeys($data) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php index d8f485561..3ead139ab 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php @@ -47,7 +47,6 @@ final class ActionTypeAggregator implements AggregatorInterface } else { $qb->groupBy('action_type_aggregator'); } - } public function applyOn() diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php index cb908ef3e..b39f8bee0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php @@ -47,7 +47,6 @@ final class GoalAggregator implements AggregatorInterface } else { $qb->groupBy('goal_aggregator'); } - } public function applyOn() diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php index ddab1f7cd..c89219f2e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php @@ -1,18 +1,25 @@ translatableStringHelper = $translatableStringHelper; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function($value): string { - if ($value === '_header') { - return 'Job'; - } - - $j = $this->jobRepository->find($value); - - return $this->translatableStringHelper->localize( - $j->getLabel() - ); - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data): array - { - return ['job_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Group by treating agent job'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $qb->join('acpw.referrers', 'u'); @@ -93,11 +52,38 @@ final class JobAggregator implements AggregatorInterface } } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::SOCIAL_WORK_ACTION_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Job'; + } + + $j = $this->jobRepository->find($value); + + return $this->translatableStringHelper->localize( + $j->getLabel() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['job_aggregator']; + } + + public function getTitle(): string + { + return 'Group by treating agent job'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php index 1815ecc19..a6ae042e5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php @@ -15,16 +15,15 @@ use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Repository\UserRepository; use Chill\MainBundle\Templating\Entity\UserRender; use Chill\PersonBundle\Export\Declarations; -use Doctrine\ORM\Query\Expr\From; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; final class ReferrerAggregator implements AggregatorInterface { - private UserRepository $userRepository; - private UserRender $userRender; + private UserRepository $userRepository; + public function __construct( UserRepository $userRepository, UserRender $userRender @@ -51,7 +50,6 @@ final class ReferrerAggregator implements AggregatorInterface } else { $qb->groupBy('referrer_aggregator'); } - } public function applyOn(): string diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php index fc602f973..fa750b486 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php @@ -49,7 +49,6 @@ final class ResultAggregator implements AggregatorInterface } else { $qb->groupBy('result_aggregator'); } - } public function applyOn() diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php index 74a73537c..0e1a7a044 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php @@ -1,18 +1,25 @@ translatableStringHelper = $translatableStringHelper; } - /** - * @inheritDoc - */ - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ($value === '_header') { - return 'Scope'; - } - - $s = $this->scopeRepository->find($value); - - return $this->translatableStringHelper->localize( - $s->getName() - ); - }; - } - - /** - * @inheritDoc - */ - public function getQueryKeys($data): array - { - return ['scope_aggregator']; - } - - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Group by treating agent scope'; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $qb->join('acpw.referrers', 'u'); @@ -93,11 +52,38 @@ final class ScopeAggregator implements AggregatorInterface } } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::SOCIAL_WORK_ACTION_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Scope'; + } + + $s = $this->scopeRepository->find($value); + + return $this->translatableStringHelper->localize( + $s->getName() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['scope_aggregator']; + } + + public function getTitle(): string + { + return 'Group by treating agent scope'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Declarations.php b/src/Bundle/ChillPersonBundle/Export/Declarations.php index f6c870e4d..0f4d84e3c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Declarations.php +++ b/src/Bundle/ChillPersonBundle/Export/Declarations.php @@ -16,15 +16,15 @@ namespace Chill\PersonBundle\Export; */ abstract class Declarations { - public const PERSON_IMPLIED_IN = 'person_implied_in'; - - public const PERSON_TYPE = 'person'; - public const ACP_TYPE = 'accompanying_period'; - public const SOCIAL_WORK_ACTION_TYPE = 'social_actions'; - public const EVAL_TYPE = 'evaluation'; public const HOUSEHOLD_TYPE = 'household'; + + public const PERSON_IMPLIED_IN = 'person_implied_in'; + + public const PERSON_TYPE = 'person'; + + public const SOCIAL_WORK_ACTION_TYPE = 'social_actions'; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php index a842284f5..72ef72119 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php @@ -21,9 +21,9 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; +use LogicException; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; -use LogicException; class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface { @@ -40,11 +40,6 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface // TODO: Implement buildForm() method. } - public function getTitle(): string - { - return 'Count accompanying courses'; - } - public function getAllowedFormattersTypes(): array { return [FormatterInterface::TYPE_TABULAR]; @@ -55,6 +50,11 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface return 'Count accompanying courses by various parameters'; } + public function getGroup(): string + { + return 'Exports of accompanying courses'; + } + public function getLabels($key, array $values, $data) { if ('export_result' !== $key) { @@ -79,6 +79,11 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR); } + public function getTitle(): string + { + return 'Count accompanying courses'; + } + public function getType(): string { return Declarations::ACP_TYPE; @@ -104,9 +109,4 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface Declarations::ACP_TYPE, ]; } - - public function getGroup(): string - { - return 'Exports of accompanying courses'; - } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php index 1e703754e..a329afee1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php @@ -1,5 +1,14 @@ repository = $em->getRepository(AccompanyingPeriod::class); } - /** - * @inheritDoc - */ public function buildForm(FormBuilderInterface $builder) { // TODO: Implement buildForm() method. } - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Count evaluations'; - } - - /** - * @inheritDoc - */ public function getAllowedFormattersTypes(): array { return [FormatterInterface::TYPE_TABULAR]; } - /** - * @inheritDoc - */ public function getDescription(): string { return 'Count evaluation by various parameters.'; } - /** - * @inheritDoc - */ + public function getGroup(): string + { + return 'Exports of evaluations'; + } + public function getLabels($key, array $values, $data) { if ('export_result' !== $key) { @@ -74,56 +67,42 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface }; } - /** - * @inheritDoc - */ public function getQueryKeys($data): array { return ['export_result']; } - /** - * @inheritDoc - */ public function getResult($qb, $data) { return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR); } - /** - * @inheritDoc - */ + public function getTitle(): string + { + return 'Count evaluations'; + } + public function getType(): string { return Declarations::EVAL_TYPE; } - /** - * @inheritDoc - */ public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { $qb = $this->repository->createQueryBuilder('acp') ->join('acp.works', 'acpw') - ->join('acpw.accompanyingPeriodWorkEvaluations', 'eval') - ; + ->join('acpw.accompanyingPeriodWorkEvaluations', 'eval'); $qb->select('COUNT(eval.id) AS export_result'); return $qb; } - /** - * @inheritDoc - */ public function requiredRole() { return new Role(AccompanyingPeriodVoter::STATS); } - /** - * @inheritDoc - */ public function supportsModifiers(): array { return [ @@ -132,9 +111,4 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface //Declarations::SOCIAL_WORK_ACTION_TYPE, ]; } - - public function getGroup(): string - { - return 'Exports of evaluations'; - } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php index a43345ff3..791c42772 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php @@ -1,5 +1,14 @@ repository = $em->getRepository(AccompanyingPeriod::class); } - /** - * @inheritDoc - */ public function buildForm(FormBuilderInterface $builder) { // TODO: Implement buildForm() method. } - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Count households'; - } - - /** - * @inheritDoc - */ public function getAllowedFormattersTypes(): array { return [FormatterInterface::TYPE_TABULAR]; } - /** - * @inheritDoc - */ public function getDescription(): string { return 'Count household by various parameters.'; } - /** - * @inheritDoc - */ + public function getGroup(): string + { + return 'Exports of households'; + } + public function getLabels($key, array $values, $data) { if ('export_result' !== $key) { @@ -73,59 +67,45 @@ class CountHousehold implements ExportInterface, GroupedExportInterface }; } - /** - * @inheritDoc - */ public function getQueryKeys($data): array { return ['export_result']; } - /** - * @inheritDoc - */ public function getResult($qb, $data) { return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR); } - /** - * @inheritDoc - */ + public function getTitle(): string + { + return 'Count households'; + } + public function getType(): string { return Declarations::HOUSEHOLD_TYPE; } - /** - * @inheritDoc - */ public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { $qb = $this->repository->createQueryBuilder('acp') ->join('acp.participations', 'acppart') ->join('acppart.person', 'person') ->join('person.householdParticipations', 'householdmember') - ->join('householdmember.household', 'household') - ; + ->join('householdmember.household', 'household'); $qb->select('COUNT(DISTINCT householdmember.household) AS export_result'); return $qb; } - /** - * @inheritDoc - */ public function requiredRole() { // TODO HouseholdVoter::STATS !?? return new Role(AccompanyingPeriodVoter::STATS); } - /** - * @inheritDoc - */ public function supportsModifiers(): array { return [ @@ -133,9 +113,4 @@ class CountHousehold implements ExportInterface, GroupedExportInterface //Declarations::ACP_TYPE ]; } - - public function getGroup(): string - { - return 'Exports of households'; - } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php index 3ef74a69e..729e5a202 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php @@ -25,7 +25,6 @@ use Symfony\Component\Security\Core\Role\Role; class CountPerson implements ExportInterface, GroupedExportInterface { - protected PersonRepository $personRepository; public function __construct( @@ -49,6 +48,11 @@ class CountPerson implements ExportInterface, GroupedExportInterface return 'Count people by various parameters.'; } + public function getGroup(): string + { + return 'Exports of persons'; + } + public function getLabels($key, array $values, $data) { if ('export_result' !== $key) { @@ -117,9 +121,4 @@ class CountPerson implements ExportInterface, GroupedExportInterface //Declarations::ACP_TYPE ]; } - - public function getGroup(): string - { - return 'Exports of persons'; - } } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php index d271bd3da..152793f97 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php @@ -1,5 +1,14 @@ repository = $em->getRepository(AccompanyingPeriod::class); } - /** - * @inheritDoc - */ public function buildForm(FormBuilderInterface $builder) { // TODO: Implement buildForm() method. } - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Count people participating in an accompanying course'; - } - - /** - * @inheritDoc - */ public function getAllowedFormattersTypes(): array { return [FormatterInterface::TYPE_TABULAR]; } - /** - * @inheritDoc - */ public function getDescription(): string { return 'Count people participating in an accompanying course by various parameters.'; } - /** - * @inheritDoc - */ + public function getGroup(): string + { + return 'Exports of persons'; + } + public function getLabels($key, array $values, $data) { if ('export_result' !== $key) { @@ -73,66 +67,47 @@ class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExpor }; } - /** - * @inheritDoc - */ public function getQueryKeys($data): array { return ['export_result']; } - /** - * @inheritDoc - */ public function getResult($qb, $data) { return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR); } - /** - * @inheritDoc - */ + public function getTitle(): string + { + return 'Count people participating in an accompanying course'; + } + public function getType(): string { return Declarations::HOUSEHOLD_TYPE; } - /** - * @inheritDoc - */ public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { $qb = $this->repository->createQueryBuilder('acp') ->join('acp.participations', 'acppart') - ->join('acppart.person', 'person') - ; + ->join('acppart.person', 'person'); $qb->select('COUNT(DISTINCT person.id) AS export_result'); return $qb; } - /** - * @inheritDoc - */ public function requiredRole() { return new Role(AccompanyingPeriodVoter::STATS); } - /** - * @inheritDoc - */ public function supportsModifiers(): array { return [ Declarations::ACP_TYPE, - Declarations::PERSON_TYPE + Declarations::PERSON_TYPE, ]; } - - public function getGroup(): string - { - return 'Exports of persons'; - } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php index cfea1f0c1..e19a40a0f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php @@ -21,8 +21,8 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; -use Symfony\Component\Form\FormBuilderInterface; use LogicException; +use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; class CountSocialWorkActions implements ExportInterface, GroupedExportInterface @@ -40,11 +40,6 @@ class CountSocialWorkActions implements ExportInterface, GroupedExportInterface // No form necessary? } - public function getTitle(): string - { - return 'Count social work actions'; - } - public function getAllowedFormattersTypes(): array { return [FormatterInterface::TYPE_TABULAR]; @@ -55,6 +50,11 @@ class CountSocialWorkActions implements ExportInterface, GroupedExportInterface return 'Count social work actions by various parameters'; } + public function getGroup(): string + { + return 'Exports of social work actions'; + } + public function getLabels($key, array $values, $data) { if ('export_result' !== $key) { @@ -79,6 +79,11 @@ class CountSocialWorkActions implements ExportInterface, GroupedExportInterface return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR); } + public function getTitle(): string + { + return 'Count social work actions'; + } + public function getType(): string { return Declarations::SOCIAL_WORK_ACTION_TYPE; @@ -87,8 +92,7 @@ class CountSocialWorkActions implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder { $qb = $this->repository->createQueryBuilder('acp') - ->join('acp.works', 'acpw') - ; + ->join('acp.works', 'acpw'); $qb->select('COUNT(acpw.id) as export_result'); @@ -107,9 +111,4 @@ class CountSocialWorkActions implements ExportInterface, GroupedExportInterface Declarations::SOCIAL_WORK_ACTION_TYPE, ]; } - - public function getGroup(): string - { - return 'Exports of social work actions'; - } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php index f2f72aa29..5f519e647 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php @@ -136,6 +136,11 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou return 'Create a list of people according to various filters.'; } + public function getGroup(): string + { + return 'Exports of persons'; + } + public function getLabels($key, array $values, $data) { switch ($key) { @@ -426,9 +431,11 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou if ('_header' === $value) { return $this->translatableStringHelper->localize($cf->getName()); } + if (null === $value) { return ''; } + return $this->customFieldProvider ->getCustomFieldByType($cf->getType()) ->render(json_decode($value, true), $cf, 'csv'); @@ -437,6 +444,7 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou if ($cfType instanceof CustomFieldChoice && $cfType->isMultiple($cf)) { return function ($value) use ($cf, $cfType, $key) { $slugChoice = $this->extractInfosFromSlug($key)['additionnalInfos']['choiceSlug']; + if (null === $value) { return ''; } @@ -475,9 +483,4 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou return $uid; } - - public function getGroup(): string - { - return 'Exports of persons'; - } } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php index 2c65acb84..7f8688493 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php @@ -129,6 +129,11 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat return 'Create a list of duplicate people'; } + public function getGroup(): string + { + return 'Exports of persons'; + } + /** * @return string */ @@ -197,9 +202,4 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat return $result->fetchAllAssociative(); } - - public function getGroup(): string - { - return 'Exports of persons'; - } } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php index 417411f98..718d04643 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php @@ -18,6 +18,7 @@ use Chill\MainBundle\Form\Type\ChillDateType; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; +use DateTime; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Query; @@ -27,7 +28,6 @@ use Symfony\Component\Security\Core\Role\Role; class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportInterface { - private EntityRepository $repository; public function __construct( @@ -36,44 +36,29 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn $this->repository = $em->getRepository(AccompanyingPeriod::class); } - /** - * @inheritDoc - */ public function buildForm(FormBuilderInterface $builder): void { $builder->add('closingdate', ChillDateType::class, [ 'label' => 'Closingdate to apply', - 'data' => new \DateTime('now'), + 'data' => new DateTime('now'), ]); } - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Accompanying courses duration'; - } - - /** - * @inheritDoc - */ public function getAllowedFormattersTypes(): array { return [FormatterInterface::TYPE_TABULAR]; } - /** - * @inheritDoc - */ public function getDescription(): string { return 'Create an average of accompanying courses duration according to various filters'; } - /** - * @inheritDoc - */ + public function getGroup(): string + { + return 'Exports of accompanying courses'; + } + public function getLabels($key, array $values, $data) { if ('export_result' !== $key) { @@ -88,33 +73,26 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn }; } - /** - * @inheritDoc - */ public function getQueryKeys($data): array { return ['export_result']; } - /** - * @inheritDoc - */ public function getResult($qb, $data) { return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR); } - /** - * @inheritDoc - */ + public function getTitle(): string + { + return 'Accompanying courses duration'; + } + public function getType(): string { return Declarations::ACP_TYPE; } - /** - * @inheritDoc - */ public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder { $qb = $this->repository->createQueryBuilder('acp'); @@ -125,34 +103,22 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn WHEN acp.closingDate IS NOT NULL THEN acp.closingDate ELSE :force_closingDate - END ) - acp.openingDate + END ) - acp.openingDate ) AS export_result') - ->setParameter('force_closingDate', $data['closingdate']) - ; + ->setParameter('force_closingDate', $data['closingdate']); return $qb; } - /** - * @inheritDoc - */ public function requiredRole(): Role { return new Role(AccompanyingPeriodVoter::STATS); } - /** - * @inheritDoc - */ public function supportsModifiers(): array { return [ - Declarations::ACP_TYPE + Declarations::ACP_TYPE, ]; } - - public function getGroup(): string - { - return 'Exports of accompanying courses'; - } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php index 933350134..6b1ad6612 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php @@ -1,60 +1,32 @@ add('on_date', ChillDateType::class, [ - 'data' => new DateTime(), - ]) - ; - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Filter by active on date'; - } - - /** - * @inheritDoc - */ - public function describeAction($data, $format = 'string'): array - { - return ['Filtered by actives courses: active on %ondate%', [ - '%ondate%' => $data['on_date']->format('d-m-Y') - ]]; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $where = $qb->getDQLPart('where'); @@ -77,11 +49,28 @@ class ActiveOnDateFilter implements FilterInterface $qb->setParameter('ondate', $data['on_date'], Types::DATE_MUTABLE); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('on_date', ChillDateType::class, [ + 'data' => new DateTime(), + ]); + } + + public function describeAction($data, $format = 'string'): array + { + return ['Filtered by actives courses: active on %ondate%', [ + '%ondate%' => $data['on_date']->format('d-m-Y'), + ]]; + } + + public function getTitle(): string + { + return 'Filter by active on date'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php index 2f83667c9..c37097d30 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php @@ -1,64 +1,32 @@ add('date_from', ChillDateType::class, [ - 'data' => new DateTime(), - ]) - ->add('date_to', ChillDateType::class, [ - 'data' => new DateTime(), - ]) - ; - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Filter by active at least one day between dates'; - } - - /** - * @inheritDoc - */ - public function describeAction($data, $format = 'string'): array - { - return ['Filtered by actives courses: at least one day between %datefrom% and %dateto%', [ - '%datefrom%' => $data['date_from']->format('d-m-Y'), - '%dateto%' => $data['date_to']->format('d-m-Y'), - ]]; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $where = $qb->getDQLPart('where'); @@ -83,11 +51,32 @@ class ActiveOneDayBetweenDatesFilter implements FilterInterface $qb->setParameter('dateto', $data['date_to'], Types::DATE_MUTABLE); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('date_from', ChillDateType::class, [ + 'data' => new DateTime(), + ]) + ->add('date_to', ChillDateType::class, [ + 'data' => new DateTime(), + ]); + } + + public function describeAction($data, $format = 'string'): array + { + return ['Filtered by actives courses: at least one day between %datefrom% and %dateto%', [ + '%datefrom%' => $data['date_from']->format('d-m-Y'), + '%dateto%' => $data['date_to']->format('d-m-Y'), + ]]; + } + + public function getTitle(): string + { + return 'Filter by active at least one day between dates'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php index 938a4e4b4..6efe29233 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php @@ -1,5 +1,14 @@ translatableStringHelper = $translatableStringHelper; } - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_activitytypes', EntityType::class, [ - 'class' => ActivityType::class, - 'choice_label' => function (ActivityType $aty) { - return $this->translatableStringHelper->localize($aty->getName()); - }, - 'multiple' => true, - 'expanded' => true - ]); - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Filter accompanying course by activity type'; - } - - /** - * @inheritDoc - */ - public function describeAction($data, $format = 'string'): array - { - $types = []; - - foreach ($data['accepted_activitytypes'] as $aty) { - $types[] = $this->translatableStringHelper->localize($aty->getName()); - } - - return ['Filtered by activity types: only %activitytypes%', [ - '%activitytypes%' => implode(", ou ", $types) - ]]; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { // One2many between activity and accompanyingperiod is not reversed ! @@ -83,8 +47,7 @@ class ActivityTypeFilter implements FilterInterface $qb ->join('act.accompanyingPeriod', 'acp') - ->join('act.activityType', 'aty') - ; + ->join('act.activityType', 'aty'); $where = $qb->getDQLPart('where'); $clause = $qb->expr()->in('aty.id', ':activitytypes'); @@ -97,14 +60,40 @@ class ActivityTypeFilter implements FilterInterface $qb->add('where', $where); $qb->setParameter('activitytypes', $data['accepted_activitytypes']); - } - /** - * @inheritDoc - */ public function applyOn() { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_activitytypes', EntityType::class, [ + 'class' => ActivityType::class, + 'choice_label' => function (ActivityType $aty) { + return $this->translatableStringHelper->localize($aty->getName()); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $types = []; + + foreach ($data['accepted_activitytypes'] as $aty) { + $types[] = $this->translatableStringHelper->localize($aty->getName()); + } + + return ['Filtered by activity types: only %activitytypes%', [ + '%activitytypes%' => implode(', ou ', $types), + ]]; + } + + public function getTitle(): string + { + return 'Filter accompanying course by activity type'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php index d3fde5b91..7bea4eb7f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php @@ -1,5 +1,14 @@ translatableStringHelper = $translatableStringHelper; } - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_locations', EntityType::class, [ - 'class' => Location::class, - 'choice_label' => function (Location $l) { - return $l->getName() .' ('. $this->translatableStringHelper->localize($l->getLocationType()->getTitle()) . ')'; - }, - 'multiple' => true, - 'expanded' => true, - ]); - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Filter by administrative location'; - } - - /** - * @inheritDoc - */ - public function describeAction($data, $format = 'string'): array - { - $locations = []; - - foreach ($data['accepted_locations'] as $l) { - $locations[] = $l->getName(); - } - - return ['Filtered by administratives locations: only %locations%', [ - '%locations%' => implode(", ou ", $locations) - ]]; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $where = $qb->getDQLPart('where'); @@ -89,11 +50,38 @@ class AdministrativeLocationFilter implements FilterInterface $qb->setParameter('locations', $data['accepted_locations']); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_locations', EntityType::class, [ + 'class' => Location::class, + 'choice_label' => function (Location $l) { + return $l->getName() . ' (' . $this->translatableStringHelper->localize($l->getLocationType()->getTitle()) . ')'; + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $locations = []; + + foreach ($data['accepted_locations'] as $l) { + $locations[] = $l->getName(); + } + + return ['Filtered by administratives locations: only %locations%', [ + '%locations%' => implode(', ou ', $locations), + ]]; + } + + public function getTitle(): string + { + return 'Filter by administrative location'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php index 23fce3f40..150a66ed1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php @@ -1,21 +1,27 @@ translatableStringHelper = $translatableStringHelper; } - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_closingmotives', EntityType::class, [ - 'class' => ClosingMotive::class, - 'choice_label' => function (ClosingMotive $cm) { - return $this->translatableStringHelper->localize($cm->getName()); - }, - 'multiple' => true, - 'expanded' => true, - ]); - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Filter by closing motive'; - } - - /** - * @inheritDoc - */ - public function describeAction($data, $format = 'string'): array - { - $motives = []; - - foreach ($data['accepted_closingmotives'] as $k => $v) { - $motives[] = $this->translatableStringHelper->localize($v->getName()); - } - - return [ - 'Filtered by closingmotive: only %closingmotives%', [ - '%closingmotives%' => implode(', ou ', $motives) - ]]; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $where = $qb->getDQLPart('where'); @@ -90,11 +50,39 @@ class ClosingMotiveFilter implements FilterInterface $qb->setParameter('closingmotive', $data['accepted_closingmotives']); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_closingmotives', EntityType::class, [ + 'class' => ClosingMotive::class, + 'choice_label' => function (ClosingMotive $cm) { + return $this->translatableStringHelper->localize($cm->getName()); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $motives = []; + + foreach ($data['accepted_closingmotives'] as $k => $v) { + $motives[] = $this->translatableStringHelper->localize($v->getName()); + } + + return [ + 'Filtered by closingmotive: only %closingmotives%', [ + '%closingmotives%' => implode(', ou ', $motives), + ], ]; + } + + public function getTitle(): string + { + return 'Filter by closing motive'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php index 23286f941..6fedf37f0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php @@ -1,5 +1,14 @@ false, 'is confidential' => true, ]; - - private CONST DEFAULT_CHOICE = false; - + + private const DEFAULT_CHOICE = false; + private TranslatorInterface $translator; - + public function __construct(TranslatorInterface $translator) { $this->translator = $translator; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_confidentials', ChoiceType::class, [ - 'choices' => self::CHOICES, - 'multiple' => false, - 'expanded' => true, - 'empty_data' => self::DEFAULT_CHOICE, - 'data' => self::DEFAULT_CHOICE, - ]); - } - - public function getTitle(): string - { - return 'Filter by confidential'; - } - - public function describeAction($data, $format = 'string'): array - { - dump($data, self::CHOICES); - - foreach (self::CHOICES as $k => $v) { - if ($v === $data['accepted_confidentials']) { - $choice = $k; - } - } - - return [ - 'Filtered by confidential: only %confidential%', [ - '%confidential%' => $this->translator->trans($choice) - ] - ]; - } - public function addRole() { return null; @@ -84,4 +60,36 @@ class ConfidentialFilter implements FilterInterface return Declarations::ACP_TYPE; } -} \ No newline at end of file + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_confidentials', ChoiceType::class, [ + 'choices' => self::CHOICES, + 'multiple' => false, + 'expanded' => true, + 'empty_data' => self::DEFAULT_CHOICE, + 'data' => self::DEFAULT_CHOICE, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + dump($data, self::CHOICES); + + foreach (self::CHOICES as $k => $v) { + if ($v === $data['accepted_confidentials']) { + $choice = $k; + } + } + + return [ + 'Filtered by confidential: only %confidential%', [ + '%confidential%' => $this->translator->trans($choice), + ], + ]; + } + + public function getTitle(): string + { + return 'Filter by confidential'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilter.php index ddebbdc6f..76ba40a59 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilter.php @@ -35,17 +35,6 @@ class CurrentUserJobFilter implements FilterInterface $this->security = $security; } - public function describeAction($data, $format = 'string') - { - return [ - 'Filtered by user job: only %job%', [ - '%job%' => $this->translatableStringHelper->localize( - $this->getUserJob()->getLabel() - ) - ], - ]; - } - public function addRole() { return null; @@ -75,16 +64,27 @@ class CurrentUserJobFilter implements FilterInterface { } + public function describeAction($data, $format = 'string') + { + return [ + 'Filtered by user job: only %job%', [ + '%job%' => $this->translatableStringHelper->localize( + $this->getUserJob()->getLabel() + ), + ], + ]; + } + public function getTitle() { return 'Filter by user job'; } - private function getUserJob():UserJob + private function getUserJob(): UserJob { /** @var User $user */ $user = $this->security->getUser(); return $user->getUserJob(); } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php index e6c56f11e..37dcac27c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php @@ -18,7 +18,6 @@ use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; -use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Security; @@ -26,9 +25,6 @@ class CurrentUserScopeFilter implements FilterInterface { private Security $security; - /** - * @var TranslatableStringHelper - */ private TranslatableStringHelper $translatableStringHelper; public function __construct( @@ -39,17 +35,6 @@ class CurrentUserScopeFilter implements FilterInterface $this->security = $security; } - public function describeAction($data, $format = 'string') - { - return [ - 'Filtered by user main scope: only %scope%', [ - '%scope%' => $this->translatableStringHelper->localize( - $this->getUserMainScope()->getName() - ) - ] - ]; - } - public function addRole() { return null; @@ -70,7 +55,6 @@ class CurrentUserScopeFilter implements FilterInterface $qb->add('where', $where); $qb->setParameter('userscope', $this->getUserMainScope()); - } public function applyOn() @@ -82,16 +66,27 @@ class CurrentUserScopeFilter implements FilterInterface { } + public function describeAction($data, $format = 'string') + { + return [ + 'Filtered by user main scope: only %scope%', [ + '%scope%' => $this->translatableStringHelper->localize( + $this->getUserMainScope()->getName() + ), + ], + ]; + } + public function getTitle() { return 'Filter by user scope'; } - private function getUserMainScope():Scope + private function getUserMainScope(): Scope { /** @var User $user */ $user = $this->security->getUser(); return $user->getMainScope(); } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php index ed874be2b..6a755638b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php @@ -1,5 +1,14 @@ true, 'is not emergency' => false, ]; - - private CONST DEFAULT_CHOICE = false; - + + private const DEFAULT_CHOICE = false; + private TranslatorInterface $translator; - + public function __construct(TranslatorInterface $translator) { $this->translator = $translator; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_emergency', ChoiceType::class, [ - 'choices' => self::CHOICES, - 'multiple' => false, - 'expanded' => true, - 'empty_data' => self::DEFAULT_CHOICE, - 'data' => self::DEFAULT_CHOICE, - ]); - } - - public function getTitle(): string - { - return 'Filter by emergency'; - } - - public function describeAction($data, $format = 'string'): array - { - foreach (self::CHOICES as $k => $v) { - if ($v === $data['accepted_emergency']) { - $choice = $k; - } - } - - return [ - 'Filtered by emergency: only %emergency%', [ - '%emergency%' => $this->translator->trans($choice) - ] - ]; - } - public function addRole() { return null; @@ -82,4 +60,34 @@ class EmergencyFilter implements FilterInterface return Declarations::ACP_TYPE; } -} \ No newline at end of file + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_emergency', ChoiceType::class, [ + 'choices' => self::CHOICES, + 'multiple' => false, + 'expanded' => true, + 'empty_data' => self::DEFAULT_CHOICE, + 'data' => self::DEFAULT_CHOICE, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + foreach (self::CHOICES as $k => $v) { + if ($v === $data['accepted_emergency']) { + $choice = $k; + } + } + + return [ + 'Filtered by emergency: only %emergency%', [ + '%emergency%' => $this->translator->trans($choice), + ], + ]; + } + + public function getTitle(): string + { + return 'Filter by emergency'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php index 4756f06c2..ab47c1cc7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php @@ -1,5 +1,14 @@ translatableStringHelper = $translatableStringHelper; } - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_evaluations', EntityType::class, [ - 'class' => Evaluation::class, - 'choice_label' => function (Evaluation $ev) { - return $this->translatableStringHelper->localize($ev->getTitle()); - }, - 'multiple' => true, - 'expanded' => true, - ]); - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Filter by evaluation'; - } - - /** - * @inheritDoc - */ - public function describeAction($data, $format = 'string'): array - { - $evaluations = []; - - foreach ($data['accepted_evaluations'] as $ev) { - $evaluations[] = $this->translatableStringHelper->localize($ev->getTitle()); - } - - return ['Filtered by evaluations: only %evals%', [ - '%evals%' => implode(", ou ", $evaluations) - ]]; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $qb ->join('acp.works', 'acpw') ->join('acpw.accompanyingPeriodWorkEvaluations', 'we') - ->join('we.evaluation', 'ev') - ; + ->join('we.evaluation', 'ev'); $where = $qb->getDQLPart('where'); $clause = $qb->expr()->in('ev.id', ':evaluations'); @@ -95,11 +55,38 @@ class EvaluationFilter implements FilterInterface $qb->setParameter('evaluations', $data['accepted_evaluations']); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_evaluations', EntityType::class, [ + 'class' => Evaluation::class, + 'choice_label' => function (Evaluation $ev) { + return $this->translatableStringHelper->localize($ev->getTitle()); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $evaluations = []; + + foreach ($data['accepted_evaluations'] as $ev) { + $evaluations[] = $this->translatableStringHelper->localize($ev->getTitle()); + } + + return ['Filtered by evaluations: only %evals%', [ + '%evals%' => implode(', ou ', $evaluations), + ]]; + } + + public function getTitle(): string + { + return 'Filter by evaluation'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php index 5445e20a4..5a1d74c1f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php @@ -1,11 +1,21 @@ add('date', ChillDateType::class, [ - 'data' => new \DateTime(), - ]) - ->add('accepted_loctype', EntityType::class, [ - 'class' => GeographicalUnit::class, - 'choice_label' => function (GeographicalUnit $u) { - return $u->getUnitName(); - }, - 'multiple' => true, - 'expanded' => true, - ]) - ; - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Filter by geographical unit'; - } - - /** - * @inheritDoc - */ - public function describeAction($data, $format = 'string'): array - { - return ['Filtered by geographic unit: only %date%', [ - '%date%' => $data['date']->format('d-m-Y'), - ]]; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $where = $qb->getDQLPart('where'); @@ -89,11 +55,36 @@ class GeographicalUnitStatFilter implements FilterInterface $qb->setParameter('loctype', $data['accepted_loctype']); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('date', ChillDateType::class, [ + 'data' => new DateTime(), + ]) + ->add('accepted_loctype', EntityType::class, [ + 'class' => GeographicalUnit::class, + 'choice_label' => static function (GeographicalUnit $u) { + return $u->getUnitName(); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + return ['Filtered by geographic unit: only %date%', [ + '%date%' => $data['date']->format('d-m-Y'), + ]]; + } + + public function getTitle(): string + { + return 'Filter by geographical unit'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php index c433c724f..22a1e2415 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php @@ -1,5 +1,14 @@ 'occasional', 'is regular' => 'regular', ]; - - private CONST DEFAULT_CHOICE = 'occasional'; - + + private const DEFAULT_CHOICE = 'occasional'; + private TranslatorInterface $translator; - + public function __construct(TranslatorInterface $translator) { $this->translator = $translator; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_intensities', ChoiceType::class, [ - 'choices' => self::CHOICES, - 'multiple' => false, - 'expanded' => true, - 'empty_data' => self::DEFAULT_CHOICE, - 'data' => self::DEFAULT_CHOICE, - ]); - } - - public function getTitle(): string - { - return 'Filter by intensity'; - } - - public function describeAction($data, $format = 'string'): array - { - foreach (self::CHOICES as $k => $v) { - if ($v === $data['accepted_intensities']) { - $choice = $k; - } - } - - return [ - 'Filtered by intensity: only %intensity%', [ - '%intensity%' => $this->translator->trans($choice) - ] - ]; - } - public function addRole() { return null; @@ -82,4 +60,34 @@ class IntensityFilter implements FilterInterface return Declarations::ACP_TYPE; } -} \ No newline at end of file + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_intensities', ChoiceType::class, [ + 'choices' => self::CHOICES, + 'multiple' => false, + 'expanded' => true, + 'empty_data' => self::DEFAULT_CHOICE, + 'data' => self::DEFAULT_CHOICE, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + foreach (self::CHOICES as $k => $v) { + if ($v === $data['accepted_intensities']) { + $choice = $k; + } + } + + return [ + 'Filtered by intensity: only %intensity%', [ + '%intensity%' => $this->translator->trans($choice), + ], + ]; + } + + public function getTitle(): string + { + return 'Filter by intensity'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php index 400ab7a14..205707831 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php @@ -1,64 +1,32 @@ add('date_from', ChillDateType::class, [ - 'data' => new DateTime(), - ]) - ->add('date_to', ChillDateType::class, [ - 'data' => new DateTime(), - ]) - ; - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Filter by opened between dates'; - } - - /** - * @inheritDoc - */ - public function describeAction($data, $format = 'string'): array - { - return ['Filtered by opening dates: between %datefrom% and %dateto%', [ - '%datefrom%' => $data['date_from']->format('d-m-Y'), - '%dateto%' => $data['date_to']->format('d-m-Y'), - ]]; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $where = $qb->getDQLPart('where'); @@ -79,11 +47,32 @@ class OpenBetweenDatesFilter implements FilterInterface $qb->setParameter('dateto', $data['date_to'], Types::DATE_MUTABLE); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('date_from', ChillDateType::class, [ + 'data' => new DateTime(), + ]) + ->add('date_to', ChillDateType::class, [ + 'data' => new DateTime(), + ]); + } + + public function describeAction($data, $format = 'string'): array + { + return ['Filtered by opening dates: between %datefrom% and %dateto%', [ + '%datefrom%' => $data['date_from']->format('d-m-Y'), + '%dateto%' => $data['date_to']->format('d-m-Y'), + ]]; + } + + public function getTitle(): string + { + return 'Filter by opened between dates'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php index 3cda93577..a67a0157c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php @@ -1,5 +1,14 @@ translatableStringHelper = $translatableStringHelper; } - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_origins', EntityType::class, [ - 'class' => Origin::class, - 'choice_label' => function (Origin $o) { - return $this->translatableStringHelper->localize($o->getLabel()); - }, - 'multiple' => true, - 'expanded' => true - ]); - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Filter by origin'; - } - - /** - * @inheritDoc - */ - public function describeAction($data, $format = 'string'): array - { - $origins = []; - - foreach ($data['accepted_origins'] as $v) { - $origins[] = $this->translatableStringHelper->localize($v->getLabel()); - } - - return ['Filtered by origins: only %origins%', [ - '%origins%' => implode(', ou ', $origins) - ]]; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $where = $qb->getDQLPart('where'); @@ -90,11 +50,38 @@ class OriginFilter implements FilterInterface $qb->setParameter('origin', $data['accepted_origins']); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_origins', EntityType::class, [ + 'class' => Origin::class, + 'choice_label' => function (Origin $o) { + return $this->translatableStringHelper->localize($o->getLabel()); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $origins = []; + + foreach ($data['accepted_origins'] as $v) { + $origins[] = $this->translatableStringHelper->localize($v->getLabel()); + } + + return ['Filtered by origins: only %origins%', [ + '%origins%' => implode(', ou ', $origins), + ]]; + } + + public function getTitle(): string + { + return 'Filter by origin'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php index 89b306678..94bf7a74c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php @@ -1,5 +1,14 @@ userRender = $userRender; } - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_referrers', EntityType::class, [ - 'class' => User::class, - 'choice_label' => function (User $u) { - return $this->userRender->renderString($u, []); - }, - 'multiple' => true, - 'expanded' => true - ]); - - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Filter by referrers'; - } - - /** - * @inheritDoc - */ - public function describeAction($data, $format = 'string'): array - { - $users = []; - - foreach ($data['accepted_referrers'] as $r) { - $users[] = $r; - } - - return [ - 'Filtered by referrer: only %referrers%', [ - '%referrers' => implode(", ou ", $users) - ]]; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $where = $qb->getDQLPart('where'); @@ -88,11 +49,39 @@ class ReferrerFilter implements FilterInterface $qb->setParameter('referrers', $data['accepted_referrers']); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_referrers', EntityType::class, [ + 'class' => User::class, + 'choice_label' => function (User $u) { + return $this->userRender->renderString($u, []); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $users = []; + + foreach ($data['accepted_referrers'] as $r) { + $users[] = $r; + } + + return [ + 'Filtered by referrer: only %referrers%', [ + '%referrers' => implode(', ou ', $users), + ], ]; + } + + public function getTitle(): string + { + return 'Filter by referrers'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php index 180775f01..3b9ed950c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php @@ -1,5 +1,14 @@ 'participation', @@ -21,12 +32,10 @@ class RequestorFilter implements FilterInterface 'no requestor' => 'no_requestor', ]; - private const DEFAULT_CHOICE = 'participation'; + protected EntityManagerInterface $em; protected TranslatorInterface $translator; - protected EntityManagerInterface $em; - public function __construct( TranslatorInterface $translator, EntityManagerInterface $em @@ -35,75 +44,35 @@ class RequestorFilter implements FilterInterface $this->em = $em; } - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_choices', ChoiceType::class, [ - 'choices' => self::REQUESTOR_CHOICES, - 'multiple' => false, - 'expanded' => true, - 'empty_data' => self::DEFAULT_CHOICE, - 'data' => self::DEFAULT_CHOICE, - ]); - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Filter by requestor'; - } - - /** - * @inheritDoc - */ - public function describeAction($data, $format = 'string'): array - { - $choice = array_flip(self::REQUESTOR_CHOICES)[$data['accepted_choices']]; - - return ['Filtered by requestor: only %choice%', [ - '%choice%' => $this->translator->trans($choice) - ]]; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $where = $qb->getDQLPart('where'); switch ($data['accepted_choices']) { case 'participation': - $qb->join('acp.participations', 'part'); $clause = $qb->expr()->andX( $qb->expr()->isNotNull('acp.requestorPerson'), $qb->expr()->eq('acp.requestorPerson', 'part.person') ); + break; case 'other_person': - $expr = $this->em->getExpressionBuilder(); - $qb->join('acp.participations','part'); + $qb->join('acp.participations', 'part'); $clause = $expr->andX( $expr->isNotNull('acp.requestorPerson'), - $expr->notIn('acp.requestorPerson', + $expr->notIn( + 'acp.requestorPerson', // subquery $this->em->createQueryBuilder() @@ -112,26 +81,26 @@ class RequestorFilter implements FilterInterface ->join('acp2.participations', 'part2') ->where($expr->eq('acp2.requestorPerson', 'part2.person')) ->getDQL() - ) ); + break; case 'thirdparty': - $clause = $qb->expr()->isNotNull('acp.requestorThirdParty'); + break; case 'no_requestor': - $clause = $qb->expr()->andX( $qb->expr()->isNull('acp.requestorPerson'), $qb->expr()->isNull('acp.requestorThirdParty') ); + break; default: - throw new \Exception('Uncaught choice exception'); + throw new Exception('Uncaught choice exception'); } if ($where instanceof Andx) { @@ -143,11 +112,33 @@ class RequestorFilter implements FilterInterface $qb->add('where', $where); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_choices', ChoiceType::class, [ + 'choices' => self::REQUESTOR_CHOICES, + 'multiple' => false, + 'expanded' => true, + 'empty_data' => self::DEFAULT_CHOICE, + 'data' => self::DEFAULT_CHOICE, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $choice = array_flip(self::REQUESTOR_CHOICES)[$data['accepted_choices']]; + + return ['Filtered by requestor: only %choice%', [ + '%choice%' => $this->translator->trans($choice), + ]]; + } + + public function getTitle(): string + { + return 'Filter by requestor'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php index d96d0ca44..979793def 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php @@ -1,5 +1,14 @@ actionRender = $actionRender; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_socialactions', EntityType::class, [ - 'class' => SocialAction::class, - 'choice_label' => function (SocialAction $sa) { - return $this->actionRender->renderString($sa, []); - }, - 'multiple' => true, - 'expanded' => true, - ]); - } - - public function getTitle(): string - { - return 'Filter by socialaction'; - } - - public function describeAction($data, $format = 'string'): array - { - $socialactions = []; - - foreach ($data['accepted_socialactions'] as $sa) { - $socialactions[] = $this->actionRender->renderString($sa, []); - } - - return ['Filtered by socialactions: only %socialactions%', [ - '%socialactions%' => implode(", ou ", $socialactions) - ]]; - } - public function addRole() { return null; @@ -69,7 +43,7 @@ class SocialActionFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('acpw', $qb->getAllAliases())) { + if (!in_array('acpw', $qb->getAllAliases(), true)) { $qb->join('acp.works', 'acpw'); } $qb->join('acpw.socialAction', 'sa'); @@ -91,4 +65,34 @@ class SocialActionFilter implements FilterInterface { return Declarations::ACP_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_socialactions', EntityType::class, [ + 'class' => SocialAction::class, + 'choice_label' => function (SocialAction $sa) { + return $this->actionRender->renderString($sa, []); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $socialactions = []; + + foreach ($data['accepted_socialactions'] as $sa) { + $socialactions[] = $this->actionRender->renderString($sa, []); + } + + return ['Filtered by socialactions: only %socialactions%', [ + '%socialactions%' => implode(', ou ', $socialactions), + ]]; + } + + public function getTitle(): string + { + return 'Filter by socialaction'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php index c2f9b1a06..f707ab9e2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php @@ -1,5 +1,14 @@ socialIssueRender = $socialIssueRender; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_socialissues', EntityType::class, [ - 'class' => SocialIssue::class, - 'choice_label' => function ($socialIssue) { - return $this->socialIssueRender->renderString($socialIssue, []); - }, - 'multiple' => true, - 'expanded' => true, - ]); - } - - public function getTitle() - { - return 'Filter by social issue'; - } - - public function describeAction($data, $format = 'string') - { - $issues = []; - - $socialissues = $this->addParentIssues($data['accepted_socialissues']); - - foreach ($socialissues as $i) { - if ('null' === $i) { - $issues[] = $this->translator->trans('Not given'); - } else { - $issues[] = $this->socialIssueRender->renderString($i, []); - } - } - - return [ - 'Filtered by socialissues: only %socialissues%', [ - '%socialissues%' => implode(', ou ', $issues) - ]]; - } - public function addRole() { return null; @@ -96,49 +62,87 @@ class SocialIssueFilter implements FilterInterface } $qb->add('where', $where); - $qb->setParameter('socialissues', + $qb->setParameter( + 'socialissues', $this->addParentIssues($data['accepted_socialissues']) ); } - /** - * "Le filtre retiendra les parcours qui comportent cette problématique, - * ou une problématique parente à celles choisies." - * - * Add parent of each socialissue selected, and remove duplicates - * - * @param $accepted_issues - * @return array - */ - private function addParentIssues($accepted_issues): array - { - $array = []; - foreach ($accepted_issues as $i) - { - /** @var SocialIssue $i */ - if ($i->hasParent()) { - $array[] = $i->getParent(); - } - $array[] = $i; - } - return $this->removeDuplicate($array); - } - - private function removeDuplicate(array $array): array - { - $ids = array_map(function ($item) { - return $item->getId(); - }, $array); - - $unique_ids = array_unique($ids); - - return array_values( - array_intersect_key($array, $unique_ids)); - } - public function applyOn() { return Declarations::ACP_TYPE; } -} \ No newline at end of file + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_socialissues', EntityType::class, [ + 'class' => SocialIssue::class, + 'choice_label' => function ($socialIssue) { + return $this->socialIssueRender->renderString($socialIssue, []); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string') + { + $issues = []; + + $socialissues = $this->addParentIssues($data['accepted_socialissues']); + + foreach ($socialissues as $i) { + if ('null' === $i) { + $issues[] = $this->translator->trans('Not given'); + } else { + $issues[] = $this->socialIssueRender->renderString($i, []); + } + } + + return [ + 'Filtered by socialissues: only %socialissues%', [ + '%socialissues%' => implode(', ou ', $issues), + ], ]; + } + + public function getTitle() + { + return 'Filter by social issue'; + } + + /** + * "Le filtre retiendra les parcours qui comportent cette problématique, + * ou une problématique parente à celles choisies.". + * + * Add parent of each socialissue selected, and remove duplicates + * + * @param $accepted_issues + */ + private function addParentIssues($accepted_issues): array + { + $array = []; + + foreach ($accepted_issues as $i) { + /** @var SocialIssue $i */ + if ($i->hasParent()) { + $array[] = $i->getParent(); + } + $array[] = $i; + } + + return $this->removeDuplicate($array); + } + + private function removeDuplicate(array $array): array + { + $ids = array_map(static function ($item) { + return $item->getId(); + }, $array); + + $unique_ids = array_unique($ids); + + return array_values( + array_intersect_key($array, $unique_ids) + ); + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilter.php index 1985031de..a7d218acc 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilter.php @@ -1,21 +1,28 @@ AccompanyingPeriod::STEP_DRAFT, @@ -23,8 +30,6 @@ class StepFilter implements FilterInterface 'Closed' => AccompanyingPeriod::STEP_CLOSED, ]; - private const DEFAULT_CHOICE = AccompanyingPeriod::STEP_CONFIRMED; - /** * @var TranslatorInterface */ @@ -35,31 +40,6 @@ class StepFilter implements FilterInterface $this->translator = $translator; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_steps', ChoiceType::class, [ - 'choices' => self::STEPS, - 'multiple' => false, - 'expanded' => true, - 'empty_data' => self::DEFAULT_CHOICE, - 'data' => self::DEFAULT_CHOICE, - ]); - } - - public function getTitle() - { - return 'Filter by step'; - } - - public function describeAction($data, $format = 'string') - { - $step = array_flip(self::STEPS)[$data['accepted_steps']]; - - return ["Filtered by steps: only %step%", [ - '%step%' => $this->translator->trans($step) - ]]; - } - public function addRole() { return null; @@ -85,4 +65,28 @@ class StepFilter implements FilterInterface return Declarations::ACP_TYPE; } -} \ No newline at end of file + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_steps', ChoiceType::class, [ + 'choices' => self::STEPS, + 'multiple' => false, + 'expanded' => true, + 'empty_data' => self::DEFAULT_CHOICE, + 'data' => self::DEFAULT_CHOICE, + ]); + } + + public function describeAction($data, $format = 'string') + { + $step = array_flip(self::STEPS)[$data['accepted_steps']]; + + return ['Filtered by steps: only %step%', [ + '%step%' => $this->translator->trans($step), + ]]; + } + + public function getTitle() + { + return 'Filter by step'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php index 6df5e38bf..d467679de 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php @@ -1,5 +1,14 @@ translatableStringHelper = $translatableStringHelper; } - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_evaluationtype', EntityType::class, [ - 'class' => Evaluation::class, - 'choice_label' => function (Evaluation $ev): string { - return $this->translatableStringHelper->localize($ev->getTitle()); - }, - 'multiple' => true, - 'expanded' => true - ]); - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Filter by evaluation type'; - } - - /** - * @inheritDoc - */ - public function describeAction($data, $format = 'string'): array - { - $evals = []; - - foreach ($data['accepted_evaluationtype'] as $ev) { - $evals[] = $this->translatableStringHelper->localize($ev->getTitle()); - } - - return ['Filtered by evaluation type: only %evals%', [ - '%evals%' => implode(", ou ", $evals) - ]]; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $where = $qb->getDQLPart('where'); $clause = $qb->expr()->in('eval.evaluation', ':evaluationtype'); - + if ($where instanceof Andx) { $where->add($clause); } else { @@ -86,11 +50,38 @@ final class EvaluationTypeFilter implements FilterInterface $qb->setParameter('evaluationtype', $data['accepted_evaluationtype']); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::EVAL_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_evaluationtype', EntityType::class, [ + 'class' => Evaluation::class, + 'choice_label' => function (Evaluation $ev): string { + return $this->translatableStringHelper->localize($ev->getTitle()); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $evals = []; + + foreach ($data['accepted_evaluationtype'] as $ev) { + $evals[] = $this->translatableStringHelper->localize($ev->getTitle()); + } + + return ['Filtered by evaluation type: only %evals%', [ + '%evals%' => implode(', ou ', $evals), + ]]; + } + + public function getTitle(): string + { + return 'Filter by evaluation type'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php index c69e15d9e..0524e3bba 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php @@ -1,5 +1,14 @@ translator = $translator; } - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('maxdate', ChoiceType::class, [ - 'choices' => self::MAXDATE_CHOICES, - 'multiple' => false, - 'expanded' => true - ]); - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Filter by maxdate'; - } - - /** - * @inheritDoc - */ - public function describeAction($data, $format = 'string'): array - { - foreach (self::MAXDATE_CHOICES as $k => $v) { - if ($v === $data['maxdate']) { - $choice = $k; - } - } - - return ['Filtered by maxdate: only %choice%', [ - '%choice%' => $this->translator->trans($choice) - ]]; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $where = $qb->getDQLPart('where'); - if ($data['maxdate'] === true) { + if (true === $data['maxdate']) { $clause = $qb->expr()->isNotNull('eval.maxDate'); } else { $clause = $qb->expr()->isNull('eval.maxDate'); @@ -90,11 +57,35 @@ class MaxDateFilter implements FilterInterface $qb->add('where', $where); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::EVAL_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('maxdate', ChoiceType::class, [ + 'choices' => self::MAXDATE_CHOICES, + 'multiple' => false, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + foreach (self::MAXDATE_CHOICES as $k => $v) { + if ($v === $data['maxdate']) { + $choice = $k; + } + } + + return ['Filtered by maxdate: only %choice%', [ + '%choice%' => $this->translator->trans($choice), + ]]; + } + + public function getTitle(): string + { + return 'Filter by maxdate'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php index 78aba8bf7..95170cb10 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php @@ -1,5 +1,14 @@ translatableStringHelper = $translatableStringHelper; } - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - $builder - ->add('accepted_composition', EntityType::class, [ - 'class' => HouseholdCompositionType::class, - 'choice_label' => function (HouseholdCompositionType $type) { - return $this->translatableStringHelper->localize( - $type->getLabel() - ); - }, - 'multiple' => true, - 'expanded' => true, - ]) - ->add('on_date', ChillDateType::class, [ - 'data' => new \DateTime('now'), - ]) - ; - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Filter by composition'; - } - - /** - * @inheritDoc - */ - public function describeAction($data, $format = 'string'): array - { - $compositions = []; - - foreach ($data['accepted_composition'] as $c) { - $compositions[] = $this->translatableStringHelper->localize( - $c->getLabel() - ); - } - - return ['Filtered by composition: only %compositions% on %ondate%', [ - '%compositions%' => implode(", ou ", $compositions), - '%ondate%' => $data['on_date']->format('d-m-Y') - ]]; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('composition', $qb->getAllAliases())) { + if (!in_array('composition', $qb->getAllAliases(), true)) { $qb->join('household.compositions', 'composition'); } @@ -113,11 +69,47 @@ class CompositionFilter implements FilterInterface $qb->setParameter('ondate', $data['on_date'], Types::DATE_MUTABLE); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::HOUSEHOLD_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('accepted_composition', EntityType::class, [ + 'class' => HouseholdCompositionType::class, + 'choice_label' => function (HouseholdCompositionType $type) { + return $this->translatableStringHelper->localize( + $type->getLabel() + ); + }, + 'multiple' => true, + 'expanded' => true, + ]) + ->add('on_date', ChillDateType::class, [ + 'data' => new DateTime('now'), + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $compositions = []; + + foreach ($data['accepted_composition'] as $c) { + $compositions[] = $this->translatableStringHelper->localize( + $c->getLabel() + ); + } + + return ['Filtered by composition: only %compositions% on %ondate%', [ + '%compositions%' => implode(', ou ', $compositions), + '%ondate%' => $data['on_date']->format('d-m-Y'), + ]]; + } + + public function getTitle(): string + { + return 'Filter by composition'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php index 47fb37214..e07d03e04 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php @@ -6,7 +6,7 @@ * 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\Filter\PersonFilters; @@ -38,10 +38,12 @@ class AgeFilter implements ExportElementValidatedInterface, FilterInterface $calc = $data['date_calc']; $clause = $qb->expr()->andX( - $qb->expr()->gte('DATE_DIFF(:calc_date, person.birthdate)/365', + $qb->expr()->gte( + 'DATE_DIFF(:calc_date, person.birthdate)/365', ':min_age' ), - $qb->expr()->lte('DATE_DIFF(:calc_date, person.birthdate)/365', + $qb->expr()->lte( + 'DATE_DIFF(:calc_date, person.birthdate)/365', ':max_age' ) ); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php index e26e3697d..2ab482039 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php @@ -17,7 +17,6 @@ use Chill\MainBundle\Form\Type\ChillDateType; use Chill\PersonBundle\Export\Declarations; use DateTime; use Doctrine\ORM\Query\Expr; -use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Validator\Context\ExecutionContextInterface; class BirthdateFilter implements ExportElementValidatedInterface, FilterInterface @@ -56,12 +55,12 @@ class BirthdateFilter implements ExportElementValidatedInterface, FilterInterfac { $builder->add('date_from', ChillDateType::class, [ 'label' => 'Born after this date', - 'data' => new DateTime() + 'data' => new DateTime(), ]); $builder->add('date_to', ChillDateType::class, [ 'label' => 'Born before this date', - 'data' => new DateTime() + 'data' => new DateTime(), ]); } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php index aaef76436..457378731 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php @@ -34,15 +34,15 @@ class DeadOrAliveFilter implements FilterInterface $personState = $data['person_state']; $calc = $data['date_calc']; - if ($personState == 'alive') { + if ('alive' === $personState) { $clause = $qb->expr()->orX( - $qb->expr()->andX( - $qb->expr()->isNull('person.deathdate'), - $qb->expr()->lte( + $qb->expr()->andX( + $qb->expr()->isNull('person.deathdate'), + $qb->expr()->lte( 'person.birthdate', ':date_calc' ) - ), + ), $qb->expr()->andX( $qb->expr()->isNotNull('person.deathdate'), $qb->expr()->gt( diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/FamilySituationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/FamilySituationFilter.php index e1a6c7529..895f83e9d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/FamilySituationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/FamilySituationFilter.php @@ -12,7 +12,6 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Filter\PersonFilters; use Chill\MainBundle\Export\FilterInterface; -use Chill\PersonBundle\Entity\Household\HouseholdCompositionType; use Chill\PersonBundle\Export\Declarations; use DateTime; use Symfony\Component\Form\Extension\Core\Type\DateType; @@ -27,7 +26,6 @@ class FamilySituationFilter implements FilterInterface public function alterQuery(\Doctrine\ORM\QueryBuilder $qb, $data) { - } public function applyOn() diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php index d8c0e1343..b2eef5285 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php @@ -36,24 +36,6 @@ class ResidentialAddressAtThirdpartyFilter implements FilterInterface return null; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('thirdparty_cat', EntityType::class, [ - 'class' => ThirdPartyCategory::class, - 'label' => 'Category', - 'choice_label' => function (ThirdPartyCategory $tpc) { - return $this->translatableStringHelper->localize($tpc->getName()); - }, - 'multiple' => true, - 'expanded' => true - ]); - - $builder->add('date_calc', ChillDateType::class, [ - 'label' => 'Date during which residential address was valid', - 'data' => new DateTime('now'), - ]); - } - public function alterQuery(QueryBuilder $qb, $data) { $qb->resetDQLPart('from'); @@ -63,7 +45,7 @@ class ResidentialAddressAtThirdpartyFilter implements FilterInterface $qb->join('person.center', 'center'); $qb->join('ra.hostThirdParty', 't'); $qb->join('t.categories', 'tc'); - + $where = $qb->getDQLPart('where'); $clause = $qb->expr()->andX( $qb->expr()->isNotNull('ra.hostThirdParty'), @@ -87,17 +69,34 @@ class ResidentialAddressAtThirdpartyFilter implements FilterInterface return Declarations::PERSON_TYPE; } + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('thirdparty_cat', EntityType::class, [ + 'class' => ThirdPartyCategory::class, + 'label' => 'Category', + 'choice_label' => function (ThirdPartyCategory $tpc) { + return $this->translatableStringHelper->localize($tpc->getName()); + }, + 'multiple' => true, + 'expanded' => true, + ]); + + $builder->add('date_calc', ChillDateType::class, [ + 'label' => 'Date during which residential address was valid', + 'data' => new DateTime('now'), + ]); + } public function describeAction($data, $format = 'string') { return ['Filtered by person\'s who have a residential address located at a thirdparty of type %thirdparty_type% and valid on %date_calc%', [ '%thirdparty_type%' => $this->translatableStringHelper->localize($data['thirdparty_cat'][0]->getName()), '%date_calc%' => $data['date_calc']->format('d-m-Y'), - ],]; + ]]; } public function getTitle() { return 'Filtered by person\'s who have a residential address located at a thirdparty of type'; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php index 835185db5..38825e022 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php @@ -13,7 +13,6 @@ namespace Chill\PersonBundle\Export\Filter\PersonFilters; use Chill\MainBundle\Export\FilterInterface; use Chill\PersonBundle\Export\Declarations; -use Doctrine\ORM\Query\Expr; use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; @@ -31,7 +30,7 @@ class ResidentialAddressAtUserFilter implements FilterInterface $qb->join('ra.person', 'person'); $qb->join('person.center', 'center'); - + $where = $qb->getDQLPart('where'); $clause = $qb->expr()->isNotNull('ra.hostPerson'); @@ -42,7 +41,6 @@ class ResidentialAddressAtUserFilter implements FilterInterface } $qb->add('where', $where); - } public function applyOn() @@ -64,4 +62,4 @@ class ResidentialAddressAtUserFilter implements FilterInterface { return 'Filtered by person\'s who have a residential address located at another user'; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php index 80efd03e3..8986d4676 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php @@ -19,12 +19,10 @@ use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\Security\Core\Security; use Symfony\Contracts\Translation\TranslatorInterface; class JobFilter implements FilterInterface { - protected TranslatorInterface $translator; private TranslatableStringHelper $translatableStringHelper; @@ -37,34 +35,6 @@ class JobFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('job', EntityType::class, [ - 'class' => UserJob::class, - 'choice_label' => function (UserJob $j) { - return $this->translatableStringHelper->localize( - $j->getLabel() - ); - }, - 'multiple' => true, - 'expanded' => true - ]); - } - - public function describeAction($data, $format = 'string') - { - $userjobs = []; - - foreach ($data['job'] as $j) { - $userjobs[] = $this->translatableStringHelper->localize( - $j->getLabel()); - } - - return ['Filtered by treating agent job: only %jobs%', [ - '%jobs%' => implode(', ou ', $userjobs) - ]]; - } - public function addRole() { return null; @@ -92,9 +62,37 @@ class JobFilter implements FilterInterface return Declarations::SOCIAL_WORK_ACTION_TYPE; } + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('job', EntityType::class, [ + 'class' => UserJob::class, + 'choice_label' => function (UserJob $j) { + return $this->translatableStringHelper->localize( + $j->getLabel() + ); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string') + { + $userjobs = []; + + foreach ($data['job'] as $j) { + $userjobs[] = $this->translatableStringHelper->localize( + $j->getLabel() + ); + } + + return ['Filtered by treating agent job: only %jobs%', [ + '%jobs%' => implode(', ou ', $userjobs), + ]]; + } public function getTitle(): string { return 'Filter by treating agent job'; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php index 1ca1d39d2..efe193a6e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php @@ -1,5 +1,14 @@ userRender = $userRender; } - /** - * @inheritDoc - */ - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('accepted_agents', EntityType::class, [ - 'class' => User::class, - 'choice_label' => function (User $u) { - return $this->userRender->renderString($u, []); - }, - 'multiple' => true, - 'expanded' => true - ]); - - } - - /** - * @inheritDoc - */ - public function getTitle(): string - { - return 'Filter by treating agent'; - } - - /** - * @inheritDoc - */ - public function describeAction($data, $format = 'string'): array - { - $users = []; - - foreach ($data['accepted_agents'] as $r) { - $users[] = $r; - } - - return [ - 'Filtered by treating agent: only %agents%', [ - '%agents' => implode(", ou ", $users) - ]]; - } - - /** - * @inheritDoc - */ public function addRole() { return null; } - /** - * @inheritDoc - */ public function alterQuery(QueryBuilder $qb, $data) { $qb->join('acpw.referrers', 'u'); @@ -90,11 +51,39 @@ class ReferrerFilter implements FilterInterface $qb->setParameter('agents', $data['accepted_agents']); } - /** - * @inheritDoc - */ public function applyOn(): string { return Declarations::SOCIAL_WORK_ACTION_TYPE; } -} \ No newline at end of file + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_agents', EntityType::class, [ + 'class' => User::class, + 'choice_label' => function (User $u) { + return $this->userRender->renderString($u, []); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $users = []; + + foreach ($data['accepted_agents'] as $r) { + $users[] = $r; + } + + return [ + 'Filtered by treating agent: only %agents%', [ + '%agents' => implode(', ou ', $users), + ], ]; + } + + public function getTitle(): string + { + return 'Filter by treating agent'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php index 6588efc18..b828a6c47 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php @@ -23,7 +23,6 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ScopeFilter implements FilterInterface { - protected TranslatorInterface $translator; private TranslatableStringHelper $translatableStringHelper; @@ -36,34 +35,6 @@ class ScopeFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function buildForm(FormBuilderInterface $builder) - { - $builder->add('scope', EntityType::class, [ - 'class' => Scope::class, - 'choice_label' => function (Scope $s) { - return $this->translatableStringHelper->localize( - $s->getName() - ); - }, - 'multiple' => true, - 'expanded' => true - ]); - } - - public function describeAction($data, $format = 'string') - { - $scopes = []; - - foreach ($data['scope'] as $s) { - $scopes[] = $this->translatableStringHelper->localize( - $s->getName()); - } - - return ['Filtered by treating agent scope: only %scopes%', [ - '%scopes%' => implode(', ou ', $scopes) - ]]; - } - public function addRole() { return null; @@ -91,9 +62,37 @@ class ScopeFilter implements FilterInterface return Declarations::SOCIAL_WORK_ACTION_TYPE; } + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('scope', EntityType::class, [ + 'class' => Scope::class, + 'choice_label' => function (Scope $s) { + return $this->translatableStringHelper->localize( + $s->getName() + ); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function describeAction($data, $format = 'string') + { + $scopes = []; + + foreach ($data['scope'] as $s) { + $scopes[] = $this->translatableStringHelper->localize( + $s->getName() + ); + } + + return ['Filtered by treating agent scope: only %scopes%', [ + '%scopes%' => implode(', ou ', $scopes), + ]]; + } public function getTitle() { return 'Filter by treating agent scope'; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php index efd8c93af..348e1e9b8 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php @@ -1,24 +1,27 @@ socialActionRender = $socialActionRender; $this->translatableStringHelper = $translatableStringHelper; $this->socialActionRepository = $socialActionRepository; } - public function buildForm(FormBuilderInterface $builder) - { - $socialActions = $this->socialActionRepository->findAll(); - - $builder->add('actionType', ChoiceType::class, [ - 'choices' => $socialActions, - 'choice_label' => function (SocialAction $sa) { - return $this->socialActionRender->renderString($sa, []); - }, - 'multiple' => true, - 'expanded' => true - ]); - - $refreshGoals = function (FormInterface $form, SocialAction $actionType = null) { - - $goals = null === $actionType ? [] : $actionType->getGoals(); - - $form->add('goal', ChoiceType::class, [ - 'placeholder' => '', - 'choices' => $goals, - 'choice_label' => function (Goal $g) { - return $this->translatableStringHelper->localize($g->getTitle()); - }, - ]); - }; - - $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($refreshGoals) { - $data = $event->getData(); - dump($data); - - $refreshGoals($event->getForm(), $data); - }); - -/* $builder->get('actionType')->addEventListener( - FormEvents::POST_SUBMIT, - function (FormEvent $event) use ($refreshGoals) { - $actionType = $event->getForm()->getData(); - dump($actionType); - $refreshGoals($event->getForm()->getParent(), $actionType); - } - );*/ - } - - public function getTitle(): string - { - return 'Filter by type of action, objectives and results'; - } - - public function describeAction($data, $format = 'string'): array - { - $actionTypes = []; - $objectives = []; - $results = []; - - foreach ($data['actionType'] as $at) { - $actionTypes[] = $at->getTitle(); - } - foreach ($data['objectives'] as $o) { - $objectives[] = $o->getTitle(); - } - foreach ($data['results'] as $r) { - $results[] = $r->getTitle(); - } - - return ['Filtered by referrers: only %actionTypes%', [ - '%actionTypes%' => implode(', ou ', $actionTypes) - ]]; - } - public function addRole() { return null; @@ -136,4 +68,74 @@ class SocialWorkTypeFilter implements FilterInterface { return Declarations::SOCIAL_WORK_ACTION_TYPE; } + + public function buildForm(FormBuilderInterface $builder) + { + $socialActions = $this->socialActionRepository->findAll(); + + $builder->add('actionType', ChoiceType::class, [ + 'choices' => $socialActions, + 'choice_label' => function (SocialAction $sa) { + return $this->socialActionRender->renderString($sa, []); + }, + 'multiple' => true, + 'expanded' => true, + ]); + + $refreshGoals = function (FormInterface $form, ?SocialAction $actionType = null) { + $goals = null === $actionType ? [] : $actionType->getGoals(); + + $form->add('goal', ChoiceType::class, [ + 'placeholder' => '', + 'choices' => $goals, + 'choice_label' => function (Goal $g) { + return $this->translatableStringHelper->localize($g->getTitle()); + }, + ]); + }; + + $builder->addEventListener(FormEvents::PRE_SUBMIT, static function (FormEvent $event) use ($refreshGoals) { + $data = $event->getData(); + dump($data); + + $refreshGoals($event->getForm(), $data); + }); + + /* $builder->get('actionType')->addEventListener( + FormEvents::POST_SUBMIT, + function (FormEvent $event) use ($refreshGoals) { + $actionType = $event->getForm()->getData(); + dump($actionType); + $refreshGoals($event->getForm()->getParent(), $actionType); + } + );*/ + } + + public function describeAction($data, $format = 'string'): array + { + $actionTypes = []; + $objectives = []; + $results = []; + + foreach ($data['actionType'] as $at) { + $actionTypes[] = $at->getTitle(); + } + + foreach ($data['objectives'] as $o) { + $objectives[] = $o->getTitle(); + } + + foreach ($data['results'] as $r) { + $results[] = $r->getTitle(); + } + + return ['Filtered by referrers: only %actionTypes%', [ + '%actionTypes%' => implode(', ou ', $actionTypes), + ]]; + } + + public function getTitle(): string + { + return 'Filter by type of action, objectives and results'; + } } diff --git a/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionTypeType.php b/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionTypeType.php index f5d26da7f..ad95c9f7a 100644 --- a/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionTypeType.php +++ b/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionTypeType.php @@ -15,7 +15,6 @@ use Chill\MainBundle\Form\Type\TranslatableStringFormType; use Chill\PersonBundle\Entity\Household\HouseholdCompositionType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; -use Symfony\Component\Form\Extension\Core\Type\NumberType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -36,4 +35,4 @@ class HouseholdCompositionTypeType extends AbstractType $resolver ->setDefault('class', HouseholdCompositionType::class); } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php index c2826485e..8a9fd42cd 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php @@ -35,11 +35,6 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository $this->repository = $entityManager->getRepository(AccompanyingPeriodWork::class); } - public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder - { - return $this->repository->createQueryBuilder($alias, $indexBy); - } - public function countByAccompanyingPeriod(AccompanyingPeriod $period): int { return $this->repository->countByAccompanyingPeriod($period); @@ -61,6 +56,11 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository ->select('count(w)')->getQuery()->getSingleScalarResult(); } + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder + { + return $this->repository->createQueryBuilder($alias, $indexBy); + } + public function find($id): ?AccompanyingPeriodWork { return $this->repository->find($id); diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php index 309e5f086..144cea507 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php @@ -31,11 +31,6 @@ final class PersonRepository implements ObjectRepository $this->repository = $entityManager->getRepository(Person::class); } - public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder - { - return $this->repository->createQueryBuilder($alias, $indexBy); - } - /** * @param $centers * @@ -56,6 +51,11 @@ final class PersonRepository implements ObjectRepository return $qb->getQuery()->getSingleScalarResult(); } + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder + { + return $this->repository->createQueryBuilder($alias, $indexBy); + } + public function find($id, $lockMode = null, $lockVersion = null): ?Person { return $this->repository->find($id, $lockMode, $lockVersion); diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php index 2144db5a3..8da2036d7 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php @@ -41,9 +41,9 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH ]; /** - * Give the ability to see statistics + * Give the ability to see all confidential courses. */ - public const STATS = 'CHILL_PERSON_ACCOMPANYING_PERIOD_STATS'; + public const CONFIDENTIAL_CRUD = 'CHILL_PERSON_ACCOMPANYING_PERIOD_CRUD_CONFIDENTIAL'; public const CREATE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_CREATE'; @@ -88,6 +88,11 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH */ public const SEE_DETAILS = 'CHILL_PERSON_ACCOMPANYING_PERIOD_SEE_DETAILS'; + /** + * Give the ability to see statistics. + */ + public const STATS = 'CHILL_PERSON_ACCOMPANYING_PERIOD_STATS'; + /** * Right to toggle confidentiality. */ @@ -95,11 +100,6 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH public const TOGGLE_CONFIDENTIAL_ALL = 'CHILL_PERSON_ACCOMPANYING_PERIOD_TOGGLE_CONFIDENTIAL_ALL'; - /** - * Give the ability to see all confidential courses. - */ - public const CONFIDENTIAL_CRUD = 'CHILL_PERSON_ACCOMPANYING_PERIOD_CRUD_CONFIDENTIAL'; - /** * Right to toggle urgency of parcours. */ @@ -218,7 +218,6 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH return $token->getUser() === $subject->getUser(); } - } return $this->voterHelper->voteOnAttribute($attribute, $subject, $token); diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseTest.php index d6fa9a843..6ce9827f3 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseTest.php @@ -1,11 +1,24 @@ export = self::$container->get('chill.person.export.count_accompanyingcourse'); } - /** - * @inheritDoc - */ public function getExport() { return $this->export; } - /** - * @inheritDoc - */ public function getFormData(): array { return [[]]; } - /** - * @inheritDoc - */ public function getModifiersCombination() { return [[Declarations::ACP_TYPE]]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountSocialWorkActionsTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountSocialWorkActionsTest.php index d904f2eeb..6fd26ff74 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountSocialWorkActionsTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountSocialWorkActionsTest.php @@ -1,11 +1,23 @@ export = self::$container->get('chill.person.export.count_social_work_actions'); } - /** - * @inheritDoc - */ public function getExport() { return $this->export; } - /** - * @inheritDoc - */ public function getFormData(): array { return [[]]; } - /** - * @inheritDoc - */ public function getModifiersCombination() { return [[Declarations::SOCIAL_WORK_ACTION_TYPE]]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/StatAccompanyingCourseDurationTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/StatAccompanyingCourseDurationTest.php index 7c1420c86..543c938f2 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/StatAccompanyingCourseDurationTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/StatAccompanyingCourseDurationTest.php @@ -1,11 +1,25 @@ \DateTime::createFromFormat('Y-m-d', '2022-06-30')], + ['closingdate' => DateTime::createFromFormat('Y-m-d', '2022-06-30')], ]; } @@ -33,4 +47,4 @@ final class StatAccompanyingCourseDurationTest extends AbstractExportTest { return [[Declarations::ACP_TYPE]]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOnDateFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOnDateFilterTest.php index b66de0f28..81c132f7c 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOnDateFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOnDateFilterTest.php @@ -1,13 +1,27 @@ filter = self::$container->get('chill.person.export.filter_activeondate'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { return [ [ - 'on_date' => \DateTime::createFromFormat('Y-m-d', '2022-05-01'), + 'on_date' => DateTime::createFromFormat('Y-m-d', '2022-05-01'), ], ]; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { if (null === self::$kernel) { @@ -62,4 +67,4 @@ class ActiveOnDateFilterTest extends AbstractFilterTest ->select('acp.id'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOneDayBetweenDatesFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOneDayBetweenDatesFilterTest.php index 051db8635..ab173d0b1 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOneDayBetweenDatesFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOneDayBetweenDatesFilterTest.php @@ -1,13 +1,27 @@ filter = self::$container->get('chill.person.export.filter_activeonedaybetweendates'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { return [ [ - 'date_from' => \DateTime::createFromFormat('Y-m-d', '2022-05-01'), - 'date_to' => \DateTime::createFromFormat('Y-m-d', '2022-06-01'), + 'date_from' => DateTime::createFromFormat('Y-m-d', '2022-05-01'), + 'date_to' => DateTime::createFromFormat('Y-m-d', '2022-06-01'), ], ]; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { if (null === self::$kernel) { @@ -63,4 +68,4 @@ class ActiveOneDayBetweenDatesFilterTest extends AbstractFilterTest ->select('acp.id'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActivityTypeFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActivityTypeFilterTest.php index 315592ee9..f59039f35 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActivityTypeFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActivityTypeFilterTest.php @@ -1,5 +1,14 @@ filter = self::$container->get('chill.person.export.filter_activitytype'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { - $em = self::$container->get(EntityManagerInterface::class); $array = $em->createQueryBuilder() @@ -50,16 +56,13 @@ class ActivityTypeFilterTest extends AbstractFilterTest $data = []; - foreach($array as $t) { + foreach ($array as $t) { $data[] = ['accepted_activitytypes' => $t]; } return $data; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { if (null === self::$kernel) { @@ -74,4 +77,4 @@ class ActivityTypeFilterTest extends AbstractFilterTest ->select('acp.id'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AdministrativeLocationFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AdministrativeLocationFilterTest.php index f974919aa..190729161 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AdministrativeLocationFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AdministrativeLocationFilterTest.php @@ -1,5 +1,14 @@ filter = self::$container->get('chill.person.export.filter_administrative_location'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { $em = self::$container->get(EntityManagerInterface::class); @@ -49,16 +56,13 @@ class AdministrativeLocationFilterTest extends AbstractFilterTest $data = []; - foreach($array as $l) { + foreach ($array as $l) { $data[] = ['accepted_locations' => $l]; } return $data; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { if (null === self::$kernel) { @@ -73,4 +77,4 @@ class AdministrativeLocationFilterTest extends AbstractFilterTest ->select('acp.id'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ClosingMotiveFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ClosingMotiveFilterTest.php index cbfa1c306..d9403506d 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ClosingMotiveFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ClosingMotiveFilterTest.php @@ -1,5 +1,14 @@ filter = self::$container->get('chill.person.export.filter_closingmotive'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { $em = self::$container->get(EntityManagerInterface::class); @@ -47,19 +54,15 @@ class ClosingMotiveFilterTest extends AbstractFilterTest $data = []; - foreach($array as $m) { + foreach ($array as $m) { $data[] = ['accepted_closingmotives' => $m]; } return $data; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { - if (null === self::$kernel) { self::bootKernel(); } @@ -72,4 +75,4 @@ class ClosingMotiveFilterTest extends AbstractFilterTest ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ConfidentialFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ConfidentialFilterTest.php index 1d8573916..6229989fe 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ConfidentialFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ConfidentialFilterTest.php @@ -1,12 +1,25 @@ filter = self::$container->get('chill.person.export.filter_confidential'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { return [ ['accepted_confidentials' => true], - ['accepted_confidentials' => false] + ['accepted_confidentials' => false], ]; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { - if (null === self::$kernel) { self::bootKernel(); } @@ -60,4 +63,4 @@ class ConfidentialFilterTest extends AbstractFilterTest ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php index 0533a604a..7ed43ea65 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php @@ -1,12 +1,25 @@ true], - ['accepted_emergencies' => false] + ['accepted_emergencies' => false], ]; } public function getQueryBuilders(): array { - if (null === self::$kernel) { self::bootKernel(); } @@ -51,4 +63,4 @@ class EmergencyFilterTest extends AbstractFilterTest ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilterTest.php index 310fde2c9..a4e39792c 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilterTest.php @@ -1,5 +1,14 @@ filter = self::$container->get('chill.person.export.filter_evaluation'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { $em = self::$container->get(EntityManagerInterface::class); @@ -49,16 +56,13 @@ class EvaluationFilterTest extends AbstractFilterTest $data = []; - foreach($array as $e) { + foreach ($array as $e) { $data[] = ['accepted_evaluations' => $e]; } return $data; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { if (null === self::$kernel) { @@ -73,4 +77,4 @@ class EvaluationFilterTest extends AbstractFilterTest ->select('acp.id'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/GeographicalUnitStatFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/GeographicalUnitStatFilterTest.php index 8a205e9ac..a2eef9038 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/GeographicalUnitStatFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/GeographicalUnitStatFilterTest.php @@ -1,13 +1,27 @@ filter = self::$container->get('chill.person.export.filter_geographicalunitstat'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { return [ [ - 'date' => \DateTime::createFromFormat('Y-m-d', '2022-05-01'), - 'accepted_loctype' => 'center' + 'date' => DateTime::createFromFormat('Y-m-d', '2022-05-01'), + 'accepted_loctype' => 'center', ], ]; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { if (null === self::$kernel) { @@ -63,4 +68,4 @@ class GeographicalUnitStatFilterTest extends AbstractFilterTest ->select('acp.id'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/IntensityFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/IntensityFilterTest.php index c39602cf8..65d2c6880 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/IntensityFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/IntensityFilterTest.php @@ -1,12 +1,25 @@ filter = self::$container->get('chill.person.export.filter_intensity'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { return [ ['accepted_intensities' => 'occasional'], - ['accepted_intensities' => 'regular'] + ['accepted_intensities' => 'regular'], ]; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { - if (null === self::$kernel) { self::bootKernel(); } @@ -60,4 +63,4 @@ class IntensityFilterTest extends AbstractFilterTest ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/JobFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/JobFilterTest.php index 6f7546b4b..9a9bb2498 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/JobFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/JobFilterTest.php @@ -1,12 +1,24 @@ filter = self::$container->get('chill.person.export.filter_job'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { return []; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { - if (null === self::$kernel) { self::bootKernel(); } @@ -57,4 +59,4 @@ class JobFilterTest extends AbstractFilterTest ->from('ChillPersonBundle:AccompanyingPeriodWork', 'acpw'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OpenBetweenDatesFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OpenBetweenDatesFilterTest.php index ccb7e38da..5e4ae3d0a 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OpenBetweenDatesFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OpenBetweenDatesFilterTest.php @@ -1,13 +1,27 @@ filter = self::$container->get('chill.person.export.filter_openbetweendates'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { return [ [ - 'date_from' => \DateTime::createFromFormat('Y-m-d', '2022-05-01'), - 'date_to' => \DateTime::createFromFormat('Y-m-d', '2022-06-01'), + 'date_from' => DateTime::createFromFormat('Y-m-d', '2022-05-01'), + 'date_to' => DateTime::createFromFormat('Y-m-d', '2022-06-01'), ], ]; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { if (null === self::$kernel) { @@ -63,4 +68,4 @@ class OpenBetweenDatesFilterTest extends AbstractFilterTest ->select('acp.id'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OriginFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OriginFilterTest.php index 7aa1f1c7a..f37cebc72 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OriginFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OriginFilterTest.php @@ -1,5 +1,14 @@ filter = self::$container->get('chill.person.export.filter_origin'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { $em = self::$container->get(EntityManagerInterface::class); @@ -47,19 +54,15 @@ class OriginFilterTest extends AbstractFilterTest $data = []; - foreach($array as $l) { + foreach ($array as $l) { $data[] = ['accepted_origins' => $l]; } return $data; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { - if (null === self::$kernel) { self::bootKernel(); } @@ -72,4 +75,4 @@ class OriginFilterTest extends AbstractFilterTest ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ReferrerFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ReferrerFilterTest.php index ec84c7027..84340e267 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ReferrerFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ReferrerFilterTest.php @@ -1,5 +1,14 @@ filter = self::$container->get('chill.person.export.filter_referrer'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { $em = self::$container->get(EntityManagerInterface::class); @@ -48,16 +55,13 @@ class ReferrerFilterTest extends AbstractFilterTest $data = []; - foreach($array as $u) { + foreach ($array as $u) { $data[] = ['accepted_referrers' => $u]; } return $data; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { if (null === self::$kernel) { @@ -79,4 +83,4 @@ class ReferrerFilterTest extends AbstractFilterTest ->select('r.id'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/RequestorFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/RequestorFilterTest.php index f8b01aea1..50dcb20f5 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/RequestorFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/RequestorFilterTest.php @@ -1,14 +1,26 @@ filter = self::$container->get('chill.person.export.filter_requestor'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { return [ @@ -47,9 +53,6 @@ class RequestorFilterTest extends AbstractFilterTest ]; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { if (null === self::$kernel) { @@ -64,4 +67,4 @@ class RequestorFilterTest extends AbstractFilterTest ->select('acp.id'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ScopeFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ScopeFilterTest.php index d387769cc..1269f0372 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ScopeFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ScopeFilterTest.php @@ -1,12 +1,24 @@ getLocale()->willReturn('fr'); $this->filter = self::$container->get('chill.person.export.filter_scope'); - } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { return []; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { - if (null === self::$kernel) { self::bootKernel(); } @@ -58,4 +59,4 @@ class ScopeFilterTest extends AbstractFilterTest ->from('ChillPersonBundle:AccompanyingPeriodWork', 'acpw'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialActionFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialActionFilterTest.php index 6de54c23a..c7834a33a 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialActionFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialActionFilterTest.php @@ -1,5 +1,14 @@ filter = self::$container->get('chill.person.export.filter_socialaction'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { $em = self::$container->get(EntityManagerInterface::class); @@ -49,16 +56,13 @@ class SocialActionFilterTest extends AbstractFilterTest $data = []; - foreach($array as $a) { + foreach ($array as $a) { $data[] = ['accepted_socialactions' => $a]; } return $data; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { if (null === self::$kernel) { @@ -73,4 +77,4 @@ class SocialActionFilterTest extends AbstractFilterTest ->select('acp.id'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialIssueFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialIssueFilterTest.php index ac092884b..16e77381f 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialIssueFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialIssueFilterTest.php @@ -1,5 +1,14 @@ filter = self::$container->get('chill.person.export.filter_socialissue'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { $em = self::$container->get(EntityManagerInterface::class); @@ -47,19 +54,15 @@ class SocialIssueFilterTest extends AbstractFilterTest $data = []; - foreach($array as $i) { + foreach ($array as $i) { $data[] = ['accepted_socialissues' => $i]; } return $data; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { - if (null === self::$kernel) { self::bootKernel(); } @@ -72,4 +75,4 @@ class SocialIssueFilterTest extends AbstractFilterTest ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/StepFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/StepFilterTest.php index 1a8dfd2ff..ac75b2123 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/StepFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/StepFilterTest.php @@ -1,12 +1,25 @@ filter = self::$container->get('chill.person.export.filter_step'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { return [ @@ -43,12 +50,8 @@ class StepFilterTest extends AbstractFilterTest ]; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { - if (null === self::$kernel) { self::bootKernel(); } @@ -61,4 +64,4 @@ class StepFilterTest extends AbstractFilterTest ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserJobFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserJobFilterTest.php index 452728384..3c91c8efa 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserJobFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserJobFilterTest.php @@ -1,12 +1,25 @@ filter = self::$container->get('chill.person.export.filter_userjob'); } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { return []; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { - if (null === self::$kernel) { self::bootKernel(); } @@ -57,4 +60,4 @@ class UserJobFilterTest extends AbstractFilterTest ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), ]; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserScopeFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserScopeFilterTest.php index fd22ded6e..72d5eaf57 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserScopeFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserScopeFilterTest.php @@ -1,12 +1,25 @@ getLocale()->willReturn('fr'); $this->filter = self::$container->get('chill.person.export.filter_userscope'); - } - /** - * @inheritDoc - */ public function getFilter() { return $this->filter; } - /** - * @inheritDoc - */ public function getFormData(): array { return []; } - /** - * @inheritDoc - */ public function getQueryBuilders(): array { - if (null === self::$kernel) { self::bootKernel(); } @@ -58,4 +60,4 @@ class UserScopeFilterTest extends AbstractFilterTest ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), ]; } -} \ No newline at end of file +} From 75bdc335e59f030fa175d683883a2e555dd61d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 5 Sep 2022 17:26:36 +0200 Subject: [PATCH 09/18] remove usage of deprecated Role into Export --- .../Aggregator/ACPAggregators/BySocialActionAggregator.php | 2 +- .../Aggregator/ACPAggregators/BySocialIssueAggregator.php | 2 +- .../Aggregator/ACPAggregators/ByThirdpartyAggregator.php | 2 +- .../Export/Aggregator/ACPAggregators/ByUserAggregator.php | 2 +- .../Export/Aggregator/ACPAggregators/DateAggregator.php | 2 +- .../Aggregator/ACPAggregators/LocationTypeAggregator.php | 2 +- .../Aggregator/ACPAggregators/UserScopeAggregator.php | 2 +- .../Export/Aggregator/ActivityTypeAggregator.php | 4 ++-- .../Export/Aggregator/ActivityUserAggregator.php | 4 ++-- .../PersonAggregators/ActivityReasonAggregator.php | 4 ++-- .../Export/Export/LinkedToACP/AvgActivityDuration.php | 4 ++-- .../Export/Export/LinkedToACP/AvgActivityVisitDuration.php | 4 ++-- .../Export/Export/LinkedToACP/CountActivity.php | 4 ++-- .../Export/Export/LinkedToACP/SumActivityDuration.php | 4 ++-- .../Export/Export/LinkedToACP/SumActivityVisitDuration.php | 4 ++-- .../Export/Export/LinkedToPerson/CountActivity.php | 4 ++-- .../Export/Export/LinkedToPerson/ListActivity.php | 4 ++-- .../Export/Export/LinkedToPerson/StatActivityDuration.php | 4 ++-- .../Export/Filter/ACPFilters/BySocialActionFilter.php | 2 +- .../Export/Filter/ACPFilters/BySocialIssueFilter.php | 2 +- .../Export/Filter/ACPFilters/ByUserFilter.php | 2 +- .../Export/Filter/ACPFilters/EmergencyFilter.php | 2 +- .../Export/Filter/ACPFilters/LocationTypeFilter.php | 2 +- .../Export/Filter/ACPFilters/SentReceivedFilter.php | 2 +- .../Export/Filter/ACPFilters/UserFilter.php | 2 +- .../Export/Filter/ACPFilters/UserScopeFilter.php | 2 +- .../Export/Filter/ActivityDateFilter.php | 2 +- .../Export/Filter/ActivityTypeFilter.php | 4 ++-- .../Export/Filter/PersonFilters/ActivityReasonFilter.php | 4 ++-- .../PersonFilters/PersonHavingActivityBetweenDateFilter.php | 2 +- .../Export/Aggregator/AgentAggregator.php | 2 +- .../Export/Aggregator/CancelReasonAggregator.php | 2 +- .../ChillCalendarBundle/Export/Aggregator/JobAggregator.php | 2 +- .../Export/Aggregator/LocationAggregator.php | 2 +- .../Export/Aggregator/LocationTypeAggregator.php | 2 +- .../Export/Aggregator/MonthYearAggregator.php | 2 +- .../Export/Aggregator/ScopeAggregator.php | 2 +- .../ChillCalendarBundle/Export/Export/CountAppointments.php | 4 ++-- .../Export/Export/StatAppointmentAvgDuration.php | 4 ++-- .../Export/Export/StatAppointmentSumDuration.php | 4 ++-- .../ChillCalendarBundle/Export/Filter/AgentFilter.php | 2 +- .../Export/Filter/BetweenDatesFilter.php | 2 +- src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php | 2 +- .../ChillCalendarBundle/Export/Filter/ScopeFilter.php | 2 +- src/Bundle/ChillMainBundle/Export/ExportInterface.php | 4 +--- src/Bundle/ChillMainBundle/Export/ExportManager.php | 2 +- src/Bundle/ChillMainBundle/Export/ModifierInterface.php | 4 ++-- .../AdministrativeLocationAggregator.php | 2 +- .../ClosingMotiveAggregator.php | 2 +- .../ConfidentialAggregator.php | 2 +- .../AccompanyingCourseAggregators/DurationAggregator.php | 2 +- .../AccompanyingCourseAggregators/EmergencyAggregator.php | 2 +- .../AccompanyingCourseAggregators/EvaluationAggregator.php | 2 +- .../AccompanyingCourseAggregators/IntensityAggregator.php | 2 +- .../AccompanyingCourseAggregators/JobAggregator.php | 2 +- .../AccompanyingCourseAggregators/OriginAggregator.php | 2 +- .../AccompanyingCourseAggregators/ReferrerAggregator.php | 2 +- .../AccompanyingCourseAggregators/ScopeAggregator.php | 2 +- .../SocialActionAggregator.php | 2 +- .../AccompanyingCourseAggregators/SocialIssueAggregator.php | 2 +- .../AccompanyingCourseAggregators/StepAggregator.php | 2 +- .../EvaluationAggregators/EvaluationTypeAggregator.php | 2 +- .../HouseholdAggregators/ChildrenNumberAggregator.php | 2 +- .../HouseholdAggregators/CompositionAggregator.php | 2 +- .../Export/Aggregator/PersonAggregators/AgeAggregator.php | 2 +- .../PersonAggregators/CountryOfBirthAggregator.php | 2 +- .../Aggregator/PersonAggregators/GenderAggregator.php | 2 +- .../PersonAggregators/HouseholdPositionAggregator.php | 2 +- .../PersonAggregators/MaritalStatusAggregator.php | 2 +- .../Aggregator/PersonAggregators/NationalityAggregator.php | 2 +- .../SocialWorkAggregators/ActionTypeAggregator.php | 2 +- .../Aggregator/SocialWorkAggregators/GoalAggregator.php | 2 +- .../Aggregator/SocialWorkAggregators/JobAggregator.php | 2 +- .../Aggregator/SocialWorkAggregators/ReferrerAggregator.php | 2 +- .../Aggregator/SocialWorkAggregators/ResultAggregator.php | 2 +- .../Aggregator/SocialWorkAggregators/ScopeAggregator.php | 2 +- .../Export/Export/CountAccompanyingCourse.php | 4 ++-- .../ChillPersonBundle/Export/Export/CountEvaluation.php | 4 ++-- .../ChillPersonBundle/Export/Export/CountHousehold.php | 6 +++--- src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php | 4 ++-- .../Export/Export/CountPersonWithAccompanyingCourse.php | 4 ++-- .../Export/Export/CountSocialWorkActions.php | 5 ++--- src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php | 4 ++-- .../Export/Export/StatAccompanyingCourseDuration.php | 4 ++-- .../Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php | 2 +- .../ActiveOneDayBetweenDatesFilter.php | 2 +- .../Filter/AccompanyingCourseFilters/ActivityTypeFilter.php | 2 +- .../AdministrativeLocationFilter.php | 2 +- .../AccompanyingCourseFilters/ClosingMotiveFilter.php | 2 +- .../Filter/AccompanyingCourseFilters/ConfidentialFilter.php | 2 +- .../AccompanyingCourseFilters/CurrentUserJobFilter.php | 2 +- .../AccompanyingCourseFilters/CurrentUserScopeFilter.php | 2 +- .../Filter/AccompanyingCourseFilters/EmergencyFilter.php | 2 +- .../Filter/AccompanyingCourseFilters/EvaluationFilter.php | 2 +- .../GeographicalUnitStatFilter.php | 2 +- .../Filter/AccompanyingCourseFilters/IntensityFilter.php | 2 +- .../AccompanyingCourseFilters/OpenBetweenDatesFilter.php | 2 +- .../Filter/AccompanyingCourseFilters/OriginFilter.php | 2 +- .../Filter/AccompanyingCourseFilters/ReferrerFilter.php | 2 +- .../Filter/AccompanyingCourseFilters/RequestorFilter.php | 2 +- .../Filter/AccompanyingCourseFilters/SocialActionFilter.php | 2 +- .../Filter/AccompanyingCourseFilters/SocialIssueFilter.php | 2 +- .../Export/Filter/AccompanyingCourseFilters/StepFilter.php | 2 +- .../Filter/EvaluationFilters/EvaluationTypeFilter.php | 2 +- .../Export/Filter/EvaluationFilters/MaxDateFilter.php | 2 +- .../Export/Filter/HouseholdFilters/CompositionFilter.php | 2 +- .../PersonFilters/AccompanyingPeriodClosingFilter.php | 2 +- .../Filter/PersonFilters/AccompanyingPeriodFilter.php | 2 +- .../PersonFilters/AccompanyingPeriodOpeningFilter.php | 2 +- .../Export/Filter/PersonFilters/AgeFilter.php | 2 +- .../Export/Filter/PersonFilters/BirthdateFilter.php | 2 +- .../Export/Filter/PersonFilters/DeadOrAliveFilter.php | 2 +- .../Export/Filter/PersonFilters/DeathdateFilter.php | 2 +- .../Export/Filter/PersonFilters/FamilySituationFilter.php | 2 +- .../Export/Filter/PersonFilters/GenderFilter.php | 2 +- .../Export/Filter/PersonFilters/NationalityFilter.php | 2 +- .../PersonFilters/ResidentialAddressAtThirdpartyFilter.php | 2 +- .../Filter/PersonFilters/ResidentialAddressAtUserFilter.php | 2 +- .../Export/Filter/SocialWorkFilters/JobFilter.php | 2 +- .../Export/Filter/SocialWorkFilters/ReferrerFilter.php | 2 +- .../Export/Filter/SocialWorkFilters/ScopeFilter.php | 2 +- .../Filter/SocialWorkFilters/SocialWorkTypeFilter.php | 2 +- .../Security/Authorization/HouseholdVoter.php | 2 ++ src/Bundle/ChillReportBundle/Export/Export/ReportList.php | 4 ++-- .../ChillReportBundle/Export/Filter/ReportDateFilter.php | 2 +- 125 files changed, 153 insertions(+), 154 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php index 62b160bc1..19299eb6a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php @@ -33,7 +33,7 @@ class BySocialActionAggregator implements AggregatorInterface $this->actionRepository = $actionRepository; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php index ff70e54b9..672076693 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php @@ -33,7 +33,7 @@ class BySocialIssueAggregator implements AggregatorInterface $this->issueRender = $issueRender; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php index ce70a9ddb..81822e801 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php @@ -33,7 +33,7 @@ class ByThirdpartyAggregator implements AggregatorInterface $this->thirdPartyRender = $thirdPartyRender; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php index d57410c4b..55df3febd 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php @@ -33,7 +33,7 @@ class ByUserAggregator implements AggregatorInterface $this->userRender = $userRender; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php index 3463b1c59..87af1629a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php @@ -38,7 +38,7 @@ class DateAggregator implements AggregatorInterface $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php index c5f43cc64..9664060da 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php @@ -33,7 +33,7 @@ class LocationTypeAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/UserScopeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/UserScopeAggregator.php index 67c2d8db1..c05196375 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/UserScopeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/UserScopeAggregator.php @@ -33,7 +33,7 @@ class UserScopeAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php index 3637d70c6..a85fb5908 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php @@ -39,9 +39,9 @@ class ActivityTypeAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { - return new Role(ActivityStatsVoter::STATS); + return null; } public function alterQuery(QueryBuilder $qb, $data) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php index 6d6d3a837..6edafba66 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php @@ -37,9 +37,9 @@ class ActivityUserAggregator implements AggregatorInterface $this->userRender = $userRender; } - public function addRole() + public function addRole(): ?string { - return new Role(ActivityStatsVoter::STATS); + return null; } public function alterQuery(QueryBuilder $qb, $data) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php index 8db93265d..e65d4586b 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php @@ -48,9 +48,9 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { - return new Role(ActivityStatsVoter::STATS); + return null; } public function alterQuery(QueryBuilder $qb, $data) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php index d06116787..abcb40327 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php @@ -92,9 +92,9 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface return $qb; } - public function requiredRole(): Role + public function requiredRole(): string { - return new Role(ActivityStatsVoter::STATS); + return ActivityStatsVoter::STATS; } public function supportsModifiers(): array diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php index 535fe3d85..e247ba820 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php @@ -92,9 +92,9 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac return $qb; } - public function requiredRole(): Role + public function requiredRole(): string { - return new Role(ActivityStatsVoter::STATS); + return ActivityStatsVoter::STATS; } public function supportsModifiers(): array diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php index cefb5e0e9..792659633 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php @@ -93,9 +93,9 @@ class CountActivity implements ExportInterface, GroupedExportInterface return $qb; } - public function requiredRole(): Role + public function requiredRole(): string { - return new Role(ActivityStatsVoter::STATS); + return ActivityStatsVoter::STATS; } public function supportsModifiers(): array diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php index 7ba914ee5..8c417769d 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php @@ -92,9 +92,9 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface return $qb; } - public function requiredRole(): Role + public function requiredRole(): string { - return new Role(ActivityStatsVoter::STATS); + return ActivityStatsVoter::STATS; } public function supportsModifiers(): array diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php index c3f7ef243..197020f3e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php @@ -92,9 +92,9 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac return $qb; } - public function requiredRole(): Role + public function requiredRole(): string { - return new Role(ActivityStatsVoter::STATS); + return ActivityStatsVoter::STATS; } public function supportsModifiers(): array diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php index 84baf657a..f920fcb27 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php @@ -97,9 +97,9 @@ class CountActivity implements ExportInterface, GroupedExportInterface return $qb; } - public function requiredRole() + public function requiredRole(): string { - return new Role(ActivityStatsVoter::STATS); + return ActivityStatsVoter::STATS; } public function supportsModifiers() diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php index 387ea8821..601188fae 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php @@ -275,9 +275,9 @@ class ListActivity implements ListInterface, GroupedExportInterface return $qb; } - public function requiredRole() + public function requiredRole(): string { - return new Role(ActivityStatsVoter::LISTS); + return ActivityStatsVoter::LISTS; } public function supportsModifiers() diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php index ebba5ad82..a628f6706 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php @@ -127,9 +127,9 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface ->setParameter(':centers', $centers); } - public function requiredRole() + public function requiredRole(): string { - return new Role(ActivityStatsVoter::STATS); + return ActivityStatsVoter::STATS; } public function supportsModifiers() diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php index d110a829f..7c3508674 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php @@ -30,7 +30,7 @@ class BySocialActionFilter implements FilterInterface $this->actionRender = $actionRender; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php index 66fa92dd4..a1b5ad1ba 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php @@ -30,7 +30,7 @@ class BySocialIssueFilter implements FilterInterface $this->issueRender = $issueRender; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php index 512dce874..75e9dfa16 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php @@ -30,7 +30,7 @@ class ByUserFilter implements FilterInterface $this->userRender = $userRender; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php index 612ef3d3d..63650b452 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php @@ -35,7 +35,7 @@ class EmergencyFilter implements FilterInterface $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php index 4519dd63a..def2ac84d 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php @@ -30,7 +30,7 @@ class LocationTypeFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php index 7c878ac75..98cb50e89 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php @@ -36,7 +36,7 @@ class SentReceivedFilter implements FilterInterface $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php index ef865b3a8..b8d6d1a59 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php @@ -29,7 +29,7 @@ class UserFilter implements FilterInterface $this->userRender = $userRender; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php index ae2ad2629..ba0f8cb75 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php @@ -30,7 +30,7 @@ class UserScopeFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php index 65057cb1e..864562cbf 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php @@ -33,7 +33,7 @@ class ActivityDateFilter implements FilterInterface $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php index 665515cb1..548b611b0 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php @@ -42,9 +42,9 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter $this->activityTypeRepository = $activityTypeRepository; } - public function addRole() + public function addRole(): ?string { - return new Role(ActivityStatsVoter::STATS); + return null; } public function alterQuery(QueryBuilder $qb, $data) diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php index c0845573a..38d5f9d5f 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php @@ -44,9 +44,9 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt $this->activityReasonRepository = $activityReasonRepository; } - public function addRole() + public function addRole(): ?string { - return new Role(ActivityStatsVoter::STATS); + return null; } public function alterQuery(QueryBuilder $qb, $data) diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php index c8c21f385..8db312e35 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php @@ -52,7 +52,7 @@ class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInt $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php index af96dd474..795c4f3f5 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php @@ -33,7 +33,7 @@ final class AgentAggregator implements AggregatorInterface $this->userRender = $userRender; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php index 2010fb90c..59e809fa0 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php @@ -33,7 +33,7 @@ class CancelReasonAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php index a2b300f24..fc2b48b12 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php @@ -33,7 +33,7 @@ final class JobAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php index 6d5a6476d..943fb0aab 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php @@ -29,7 +29,7 @@ final class LocationAggregator implements AggregatorInterface $this->locationRepository = $locationRepository; } - public function addRole(): ?Role + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php index 4ead075d5..a11060b95 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php @@ -33,7 +33,7 @@ final class LocationTypeAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php index 42bac218d..35b79dcf8 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php @@ -20,7 +20,7 @@ use Symfony\Component\Security\Core\Role\Role; class MonthYearAggregator implements AggregatorInterface { - public function addRole(): ?Role + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php index 891837aa7..6da361cb9 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php @@ -33,7 +33,7 @@ final class ScopeAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/CountAppointments.php b/src/Bundle/ChillCalendarBundle/Export/Export/CountAppointments.php index 36864e92e..b9da17114 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/CountAppointments.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/CountAppointments.php @@ -103,10 +103,10 @@ class CountAppointments implements ExportInterface, GroupedExportInterface return $qb; } - public function requiredRole(): Role + public function requiredRole(): string { // which role should we give here? - return new Role(PersonVoter::STATS); + return PersonVoter::STATS; } public function supportsModifiers(): array diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentAvgDuration.php b/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentAvgDuration.php index 1b4af1ce5..800ab1d55 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentAvgDuration.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentAvgDuration.php @@ -97,9 +97,9 @@ class StatAppointmentAvgDuration implements ExportInterface, GroupedExportInterf return $qb; } - public function requiredRole(): Role + public function requiredRole(): string { - return new Role(AccompanyingPeriodVoter::STATS); + return AccompanyingPeriodVoter::STATS; } public function supportsModifiers(): array diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentSumDuration.php b/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentSumDuration.php index 1960af2e4..ac8303abf 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentSumDuration.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentSumDuration.php @@ -97,9 +97,9 @@ class StatAppointmentSumDuration implements ExportInterface, GroupedExportInterf return $qb; } - public function requiredRole(): Role + public function requiredRole(): string { - return new Role(AccompanyingPeriodVoter::STATS); + return AccompanyingPeriodVoter::STATS; } public function supportsModifiers(): array diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php index ee4e82350..1692e0b3a 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php @@ -29,7 +29,7 @@ class AgentFilter implements FilterInterface $this->userRender = $userRender; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php index 74b481abe..a76160a9b 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php @@ -21,7 +21,7 @@ use Symfony\Component\Form\FormBuilderInterface; class BetweenDatesFilter implements FilterInterface { - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php index 562c3281e..ff168d2f8 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php @@ -35,7 +35,7 @@ class JobFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php index 3ac1d0f1b..fb154bf61 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php @@ -35,7 +35,7 @@ class ScopeFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillMainBundle/Export/ExportInterface.php b/src/Bundle/ChillMainBundle/Export/ExportInterface.php index 419d9b250..6319fbac9 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportInterface.php +++ b/src/Bundle/ChillMainBundle/Export/ExportInterface.php @@ -139,10 +139,8 @@ interface ExportInterface extends ExportElementInterface /** * Return the required Role to execute the Export. - * - * @return \Symfony\Component\Security\Core\Role\Role */ - public function requiredRole(); + public function requiredRole(): string; /** * Inform which ModifiersInterface (i.e. AggregatorInterface, FilterInterface) diff --git a/src/Bundle/ChillMainBundle/Export/ExportManager.php b/src/Bundle/ChillMainBundle/Export/ExportManager.php index ed24f1661..9ba9bc1a8 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportManager.php +++ b/src/Bundle/ChillMainBundle/Export/ExportManager.php @@ -550,7 +550,7 @@ class ExportManager if (null === $centers) { $centers = $this->authorizationHelper->getReachableCenters( $this->user, - $role->getRole(), + $role ); } diff --git a/src/Bundle/ChillMainBundle/Export/ModifierInterface.php b/src/Bundle/ChillMainBundle/Export/ModifierInterface.php index 1265f52c4..ac8e3e692 100644 --- a/src/Bundle/ChillMainBundle/Export/ModifierInterface.php +++ b/src/Bundle/ChillMainBundle/Export/ModifierInterface.php @@ -26,9 +26,9 @@ interface ModifierInterface extends ExportElementInterface * If null, will used the ExportInterface::requiredRole role from * the current executing export. * - * @return \Symfony\Component\Security\Core\Role\Role|null A role required to execute this ModifiersInterface + * @return string|null A role required to execute this ModifiersInterface */ - public function addRole(); + public function addRole(): ?string; /** * Alter the query initiated by the export, to add the required statements diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php index 69d1b265d..a1cf7160b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php @@ -32,7 +32,7 @@ class AdministrativeLocationAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php index d525f2f9b..b0f8f98f0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php @@ -33,7 +33,7 @@ class ClosingMotiveAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php index 534ef268a..ec9bdd348 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php @@ -27,7 +27,7 @@ class ConfidentialAggregator implements AggregatorInterface $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php index ba6a1d3df..ca09784e4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php @@ -35,7 +35,7 @@ class DurationAggregator implements AggregatorInterface $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php index 4bee25a39..f59491ec5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php @@ -27,7 +27,7 @@ class EmergencyAggregator implements AggregatorInterface $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php index 4c9fefe31..96c63b9cf 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php @@ -33,7 +33,7 @@ final class EvaluationAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php index 5962654c0..711f7ec0d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php @@ -27,7 +27,7 @@ class IntensityAggregator implements AggregatorInterface $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php index c5c9c3180..6443cc02e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php @@ -32,7 +32,7 @@ final class JobAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php index 7c4ad76fd..b98edae32 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php @@ -34,7 +34,7 @@ final class OriginAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php index 323a17e26..a1df6b559 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php @@ -32,7 +32,7 @@ final class ReferrerAggregator implements AggregatorInterface $this->userRender = $userRender; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php index 46187d558..c7b3142f2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php @@ -32,7 +32,7 @@ final class ScopeAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php index f28cd559b..39ad085e3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php @@ -33,7 +33,7 @@ final class SocialActionAggregator implements AggregatorInterface $this->actionRepository = $actionRepository; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php index 362d8e666..7cb726673 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php @@ -32,7 +32,7 @@ final class SocialIssueAggregator implements AggregatorInterface $this->issueRender = $issueRender; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php index 7d3423a04..5c923fdc2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php @@ -33,7 +33,7 @@ final class StepAggregator implements AggregatorInterface //, FilterInterface $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php index 6c20ae548..b4f5e0071 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php @@ -32,7 +32,7 @@ class EvaluationTypeAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php index 417941a04..a4d15b7a5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php @@ -30,7 +30,7 @@ class ChildrenNumberAggregator implements AggregatorInterface $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php index 429431af6..fdb18e951 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php @@ -37,7 +37,7 @@ class CompositionAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php index 00dd93a4b..a2cbe3ba3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php @@ -29,7 +29,7 @@ final class AgeAggregator implements AggregatorInterface, ExportElementValidated $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php index f54bffd0b..4fac30f42 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php @@ -42,7 +42,7 @@ final class CountryOfBirthAggregator implements AggregatorInterface, ExportEleme $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php index 1e0a7082b..0b94cbd4f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php @@ -28,7 +28,7 @@ final class GenderAggregator implements AggregatorInterface $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php index 872b3f9f5..57da680ca 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php @@ -37,7 +37,7 @@ final class HouseholdPositionAggregator implements AggregatorInterface, ExportEl $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php index 4a9534a6d..5e39c6310 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php @@ -30,7 +30,7 @@ final class MaritalStatusAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php index fcae239cb..eb58913c3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php @@ -41,7 +41,7 @@ final class NationalityAggregator implements AggregatorInterface, ExportElementV $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php index 3ead139ab..1cd7949d0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php @@ -30,7 +30,7 @@ final class ActionTypeAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php index b39f8bee0..d1f33ca7a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php @@ -30,7 +30,7 @@ final class GoalAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php index c89219f2e..10c588809 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php @@ -32,7 +32,7 @@ final class JobAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php index a6ae042e5..efda6b783 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php @@ -32,7 +32,7 @@ final class ReferrerAggregator implements AggregatorInterface $this->userRender = $userRender; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php index fa750b486..9bdcebb60 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php @@ -30,7 +30,7 @@ final class ResultAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php index 0e1a7a044..ee2509977 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php @@ -32,7 +32,7 @@ final class ScopeAggregator implements AggregatorInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php index 72ef72119..757154fd6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php @@ -98,9 +98,9 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface return $qb; } - public function requiredRole(): Role + public function requiredRole(): string { - return new Role(AccompanyingPeriodVoter::STATS); + return AccompanyingPeriodVoter::STATS; } public function supportsModifiers(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php index a329afee1..e142edd11 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php @@ -98,9 +98,9 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface return $qb; } - public function requiredRole() + public function requiredRole(): string { - return new Role(AccompanyingPeriodVoter::STATS); + return AccompanyingPeriodVoter::STATS; } public function supportsModifiers(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php index 791c42772..e5f263128 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php @@ -17,6 +17,7 @@ use Chill\MainBundle\Export\GroupedExportInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; +use Chill\PersonBundle\Security\Authorization\HouseholdVoter; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Query; @@ -100,10 +101,9 @@ class CountHousehold implements ExportInterface, GroupedExportInterface return $qb; } - public function requiredRole() + public function requiredRole(): string { - // TODO HouseholdVoter::STATS !?? - return new Role(AccompanyingPeriodVoter::STATS); + return HouseholdVoter::STATS; } public function supportsModifiers(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php index 729e5a202..44027a1c8 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php @@ -108,9 +108,9 @@ class CountPerson implements ExportInterface, GroupedExportInterface return $qb; } - public function requiredRole() + public function requiredRole(): string { - return new Role(PersonVoter::STATS); + return PersonVoter::STATS; } public function supportsModifiers() diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php index 152793f97..52f558d54 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php @@ -98,9 +98,9 @@ class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExpor return $qb; } - public function requiredRole() + public function requiredRole(): string { - return new Role(AccompanyingPeriodVoter::STATS); + return AccompanyingPeriodVoter::STATS; } public function supportsModifiers(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php index e19a40a0f..870077dd6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php @@ -99,10 +99,9 @@ class CountSocialWorkActions implements ExportInterface, GroupedExportInterface return $qb; } - public function requiredRole(): Role + public function requiredRole(): string { - //TODO change to string, but changes needed also in ExportManager and possibly other locations. - return new Role(AccompanyingPeriodVoter::STATS); + return AccompanyingPeriodVoter::STATS; } public function supportsModifiers(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php index 5f519e647..659887b51 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php @@ -355,9 +355,9 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou return $qb; } - public function requiredRole() + public function requiredRole(): string { - return new Role(PersonVoter::LISTS); + return PersonVoter::LISTS; } public function supportsModifiers() diff --git a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php index 718d04643..6cdf04924 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php @@ -110,9 +110,9 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn return $qb; } - public function requiredRole(): Role + public function requiredRole(): string { - return new Role(AccompanyingPeriodVoter::STATS); + return AccompanyingPeriodVoter::STATS; } public function supportsModifiers(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php index 6b1ad6612..b52b8b34a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ActiveOnDateFilter implements FilterInterface { - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php index c37097d30..6e2fa3288 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class ActiveOneDayBetweenDatesFilter implements FilterInterface { - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php index 6efe29233..845b318b9 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php @@ -32,7 +32,7 @@ class ActivityTypeFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php index 7bea4eb7f..9b2fd7634 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php @@ -30,7 +30,7 @@ class AdministrativeLocationFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php index 150a66ed1..636524d04 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php @@ -30,7 +30,7 @@ class ClosingMotiveFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php index 6fedf37f0..3ebf77182 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php @@ -35,7 +35,7 @@ class ConfidentialFilter implements FilterInterface $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilter.php index 76ba40a59..6c098e028 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilter.php @@ -35,7 +35,7 @@ class CurrentUserJobFilter implements FilterInterface $this->security = $security; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php index 37dcac27c..cbbd9bef5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php @@ -35,7 +35,7 @@ class CurrentUserScopeFilter implements FilterInterface $this->security = $security; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php index 6a755638b..b9c835080 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php @@ -35,7 +35,7 @@ class EmergencyFilter implements FilterInterface $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php index ab47c1cc7..7df43a06f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php @@ -30,7 +30,7 @@ class EvaluationFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php index 5a1d74c1f..8f6748b70 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php @@ -34,7 +34,7 @@ use Symfony\Component\Form\FormBuilderInterface; */ class GeographicalUnitStatFilter implements FilterInterface { - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php index 22a1e2415..a98a6ec11 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php @@ -35,7 +35,7 @@ class IntensityFilter implements FilterInterface $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php index 205707831..a782fdb88 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class OpenBetweenDatesFilter implements FilterInterface { - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php index a67a0157c..200d8e8b0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php @@ -30,7 +30,7 @@ class OriginFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php index 94bf7a74c..6e680849d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php @@ -29,7 +29,7 @@ class ReferrerFilter implements FilterInterface $this->userRender = $userRender; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php index 3b9ed950c..240d6c365 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php @@ -44,7 +44,7 @@ class RequestorFilter implements FilterInterface $this->em = $em; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php index 979793def..50889225c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php @@ -36,7 +36,7 @@ class SocialActionFilter implements FilterInterface $this->actionRender = $actionRender; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php index f707ab9e2..fdcb15ee7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php @@ -43,7 +43,7 @@ class SocialIssueFilter implements FilterInterface $this->socialIssueRender = $socialIssueRender; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilter.php index a7d218acc..dda95ff74 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilter.php @@ -40,7 +40,7 @@ class StepFilter implements FilterInterface $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php index d467679de..74f6fef75 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php @@ -30,7 +30,7 @@ final class EvaluationTypeFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php index 0524e3bba..371955bfa 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php @@ -33,7 +33,7 @@ class MaxDateFilter implements FilterInterface $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php index 95170cb10..3d00ed36b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php @@ -34,7 +34,7 @@ class CompositionFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodClosingFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodClosingFilter.php index 67ebf137b..e56782847 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodClosingFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodClosingFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class AccompanyingPeriodClosingFilter extends AbstractAccompanyingPeriodExportElement implements FilterInterface { - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodFilter.php index b92c4cc1d..5a7ccb4a3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class AccompanyingPeriodFilter extends AbstractAccompanyingPeriodExportElement implements FilterInterface { - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodOpeningFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodOpeningFilter.php index 398e516d5..33805d392 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodOpeningFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodOpeningFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class AccompanyingPeriodOpeningFilter extends AbstractAccompanyingPeriodExportElement implements FilterInterface { - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php index e07d03e04..bada59a8d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php @@ -24,7 +24,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class AgeFilter implements ExportElementValidatedInterface, FilterInterface { - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php index 2ab482039..30d0612a0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php @@ -21,7 +21,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class BirthdateFilter implements ExportElementValidatedInterface, FilterInterface { - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php index 457378731..3b15cff7b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; class DeadOrAliveFilter implements FilterInterface { - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php index e955a33b9..ba8e8c150 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php @@ -23,7 +23,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class DeathdateFilter implements ExportElementValidatedInterface, FilterInterface { - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/FamilySituationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/FamilySituationFilter.php index 895f83e9d..3c2befd75 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/FamilySituationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/FamilySituationFilter.php @@ -19,7 +19,7 @@ use Symfony\Component\Form\Extension\Core\Type\DateType; class FamilySituationFilter implements FilterInterface { //TODO where to find this property? On VendeePerson rather than Person. Not sure what this refers to exactly... - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GenderFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GenderFilter.php index 373d9798c..02833d14c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GenderFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GenderFilter.php @@ -42,7 +42,7 @@ class GenderFilter implements $this->translator = $translator; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php index d10de8f30..eec380170 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php @@ -36,7 +36,7 @@ class NationalityFilter implements $this->translatableStringHelper = $helper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php index b2eef5285..860598927 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php @@ -31,7 +31,7 @@ class ResidentialAddressAtThirdpartyFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php index 38825e022..5fd2a718b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php @@ -18,7 +18,7 @@ use Doctrine\ORM\QueryBuilder; class ResidentialAddressAtUserFilter implements FilterInterface { - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php index 8986d4676..386570c8e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php @@ -35,7 +35,7 @@ class JobFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php index efe193a6e..f3fa7e359 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php @@ -29,7 +29,7 @@ class ReferrerFilter implements FilterInterface $this->userRender = $userRender; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php index b828a6c47..d707edf7f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php @@ -35,7 +35,7 @@ class ScopeFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php index 348e1e9b8..e7ae21663 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php @@ -44,7 +44,7 @@ class SocialWorkTypeFilter implements FilterInterface $this->socialActionRepository = $socialActionRepository; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/HouseholdVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/HouseholdVoter.php index cdc62c2cf..5f6a1c542 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/HouseholdVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/HouseholdVoter.php @@ -25,6 +25,8 @@ class HouseholdVoter extends Voter public const SEE = 'CHILL_PERSON_HOUSEHOLD_SEE'; + public const STATS = 'CHILL_PERSON_HOUSEHOLD_STATS'; + /** * @deprecated use @see{self::SEE} instead */ diff --git a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php index b2b436485..3534a5f38 100644 --- a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php +++ b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php @@ -458,9 +458,9 @@ class ReportList implements ExportElementValidatedInterface, ListInterface ->setParameter('authorized_centers', $centers); } - public function requiredRole() + public function requiredRole(): string { - return new Role(ReportVoter::LISTS); + return ReportVoter::LISTS; } public function supportsModifiers() diff --git a/src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php b/src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php index 0cdb8e26c..84facc5ba 100644 --- a/src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php +++ b/src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php @@ -18,7 +18,7 @@ use Doctrine\ORM\Query\Expr; class ReportDateFilter implements FilterInterface { - public function addRole() + public function addRole(): ?string { return null; } From 3295031bcd7e250849e27296e8f96ea35122ef50 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 6 Sep 2022 10:04:59 +0200 Subject: [PATCH 10/18] marital status filter --- .../PersonFilters/MaritalStatusFilter.php | 24 +++++++++++---- .../config/services/exports_person.yaml | 29 ++++++++++++------- .../translations/messages.fr.yml | 4 +-- 3 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php index 985bfe741..7a72179a8 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php @@ -13,6 +13,8 @@ namespace Chill\PersonBundle\Export\Filter\PersonFilters; use Chill\MainBundle\Entity\UserJob; use Chill\MainBundle\Export\FilterInterface; +use Chill\MainBundle\Form\Type\ChillDateType; +use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\Household\HouseholdCompositionType; use Chill\PersonBundle\Entity\MaritalStatus; use Chill\PersonBundle\Export\Declarations; @@ -20,9 +22,18 @@ use DateTime; use Doctrine\ORM\Query\Expr\Andx; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\Extension\Core\Type\DateType; +use Symfony\Contracts\Translation\TranslatorInterface; class MaritalStatusFilter implements FilterInterface { + private TranslatableStringHelper $translatableStringHelper; + + public function __construct( + TranslatableStringHelper $translatableStringHelper + ) { + $this->translatableStringHelper = $translatableStringHelper; + } + public function addRole() { return null; @@ -33,8 +44,11 @@ class MaritalStatusFilter implements FilterInterface $where = $qb->getDQLPart('where'); $clause = $qb->expr()->andX( - $qb->expr()->in('p.maritalStatus', ':maritalStatus'), - $qb->expr()->eq('p.maritalStatusDate', ':calc_date') + $qb->expr()->in('person.maritalStatus', ':maritalStatus'), + $qb->expr()->orX( + $qb->expr()->eq('person.maritalStatusDate', ':calc_date'), + $qb->expr()->isNull('person.maritalStatusDate') + ) ); if ($where instanceof Andx) { @@ -45,7 +59,7 @@ class MaritalStatusFilter implements FilterInterface $qb->add('where', $where); $qb->setParameter('maritalStatus', $data['maritalStatus']); - $qb->setParameter('maritalStatusDate', $data['calc_date']); + $qb->setParameter('calc_date', $data['calc_date']); } public function applyOn() @@ -59,14 +73,14 @@ class MaritalStatusFilter implements FilterInterface 'class' => MaritalStatus::class, 'choice_label' => function (MaritalStatus $ms) { return $this->translatableStringHelper->localize( - $ms->getLabel() + $ms->getName() ); }, 'multiple' => true, 'expanded' => true ]); - $builder->add('date_calc', DateType::class, [ + $builder->add('calc_date', ChillDateType::class, [ 'label' => 'Marital status at this time', 'data' => new DateTime(), ]); diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml index ae8f90b78..fa1c8df8d 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml @@ -14,7 +14,7 @@ services: autoconfigure: true tags: - { name: chill.export, alias: count_person_with_accompanying_course } - + chill.person.export.list_person: class: Chill\PersonBundle\Export\Export\ListPerson autowire: true @@ -39,24 +39,24 @@ services: autoconfigure: true tags: - { name: chill.export_filter, alias: person_gender_filter } - + chill.person.export.filter_age: class: Chill\PersonBundle\Export\Filter\PersonFilters\AgeFilter autowire: true autoconfigure: true tags: - { name: chill.export_filter, alias: person_age_filter } - + chill.person.export.filter_birthdate: class: Chill\PersonBundle\Export\Filter\PersonFilters\BirthdateFilter tags: - { name: chill.export_filter, alias: person_birthdate_filter } - + chill.person.export.filter_deathdate: class: Chill\PersonBundle\Export\Filter\PersonFilters\DeathdateFilter tags: - { name: chill.export_filter, alias: person_deathdate_filter } - + chill.person.export.filter_dead_or_alive: class: Chill\PersonBundle\Export\Filter\PersonFilters\DeadOrAliveFilter tags: @@ -68,7 +68,7 @@ services: autoconfigure: true tags: - { name: chill.export_filter, alias: person_nationality_filter } - + chill.person.export.filter_residential_address_at_user: class: Chill\PersonBundle\Export\Filter\PersonFilters\ResidentialAddressAtUserFilter autowire: true @@ -83,6 +83,13 @@ services: tags: - { name: chill.export_filter, alias: person_residential_address_at_thirdparty_filter } + chill.person.export.filter_marital_status: + class: Chill\PersonBundle\Export\Filter\PersonFilters\MaritalStatusFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: person_marital_status_filter } + ## Aggregators chill.person.export.aggregator_nationality: class: Chill\PersonBundle\Export\Aggregator\PersonAggregators\NationalityAggregator @@ -90,35 +97,35 @@ services: autoconfigure: true tags: - { name: chill.export_aggregator, alias: person_nationality_aggregator } - + chill.person.export.aggregator_country_of_birth: class: Chill\PersonBundle\Export\Aggregator\PersonAggregators\CountryOfBirthAggregator autowire: true autoconfigure: true tags: - { name: chill.export_aggregator, alias: person_country_of_birth_aggregator } - + chill.person.export.aggregator_gender: class: Chill\PersonBundle\Export\Aggregator\PersonAggregators\GenderAggregator autowire: true autoconfigure: true tags: - { name: chill.export_aggregator, alias: person_gender_aggregator } - + chill.person.export.aggregator_age: class: Chill\PersonBundle\Export\Aggregator\PersonAggregators\AgeAggregator autowire: true autoconfigure: true tags: - { name: chill.export_aggregator, alias: person_age_aggregator } - + chill.person.export.aggregator_marital_status: class: Chill\PersonBundle\Export\Aggregator\PersonAggregators\MaritalStatusAggregator autowire: true autoconfigure: true tags: - { name: chill.export_aggregator, alias: person_marital_status_aggregator } - + chill.person.export.aggregator_household_position: class: Chill\PersonBundle\Export\Aggregator\PersonAggregators\HouseholdPositionAggregator autowire: true diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 7cf7d34b9..2219fba06 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -401,8 +401,8 @@ Family composition: Composition familiale Family composition at this time: Composition familiale à cette date. Filtered by person's marital status: Filtré par état matrimonial -Filter by person's marital status: Filtrer par état matrimonial à une certaine date. -Marital status at this time: État matrimonial à cette date. +Filter by person's marital status: Filtrer par état matrimonial +Marital status at this time: État matrimonial par rapport à cette date Filter by entrusted child status: Filtrer les usagers qui sont "enfant confié" Filtered by entrusted child status: Uniquement les usagers qui sont "enfant confié" From d245afb0094c26c3d66b06deb6c999259d2f54f3 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 6 Sep 2022 14:41:40 +0200 Subject: [PATCH 11/18] correct identification of from() --- .../PersonAggregators/HouseholdPositionAggregator.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php index ec4a270ac..0a7a6d387 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php @@ -15,6 +15,7 @@ use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Export\ExportElementValidatedInterface; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Templating\TranslatableStringHelper; +use Chill\PersonBundle\Entity\Household\HouseholdMember; use Chill\PersonBundle\Repository\Household\PositionRepository; use DateTime; use Doctrine\ORM\QueryBuilder; @@ -46,7 +47,7 @@ final class HouseholdPositionAggregator implements AggregatorInterface, ExportEl public function alterQuery(QueryBuilder $qb, $data) { $qb->resetDQLPart('from'); - $qb->from('ChillPersonBundle:Household\HouseholdMember', 'hm'); + $qb->from(HouseholdMember::class, 'hm'); $qb->join('hm.person', 'person'); $qb->join('person.center', 'center'); @@ -70,7 +71,7 @@ final class HouseholdPositionAggregator implements AggregatorInterface, ExportEl } else { $qb->groupBy('household_position_aggregator'); } - + } public function applyOn() From 29cc589bf2e414d913e1c7eef6af577d6cddf3f1 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 8 Aug 2022 15:24:22 +0200 Subject: [PATCH 12/18] exports: add a new GeographicalUnitStat aggregator --- .../GeographicalUnitStatAggregator.php | 96 +++++++++++++++++++ .../services/exports_accompanying_course.yaml | 7 ++ .../translations/messages.fr.yml | 2 + 3 files changed, 105 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php new file mode 100644 index 000000000..ed5d80ae8 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php @@ -0,0 +1,96 @@ +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; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml index 1e313d59d..de10f5788 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml @@ -178,6 +178,13 @@ services: tags: - { 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: class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\SocialActionAggregator autowire: true diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index dc32a2cae..e909f0ab7 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -449,6 +449,8 @@ Step: Statut Group by step: Grouper les parcours par statut du parcours 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 Accepted socialactions: Actions d'accompagnement From d3a0c4c2838c022c1c7be9a9bf35b7b4117cc6bb Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 6 Sep 2022 15:34:42 +0200 Subject: [PATCH 13/18] exports tests: move tests in sub-folder, adapt namespace + fix errors --- .../Export/Filter/PersonFilters/MaritalStatusFilter.php | 2 +- .../{ => PersonAggregators}/AgeAggregatorTest.php | 4 ++-- .../{ => PersonAggregators}/GenderAggregatorTest.php | 4 ++-- .../{ => PersonAggregators}/NationalityAggregatorTest.php | 4 ++-- .../ActionTypeAggregatorTest.php | 4 ++-- .../{ => SocialWorkAggregators}/GoalAggregatorTest.php | 4 ++-- .../ReferrerAggregatorTest.php | 4 ++-- .../{ => SocialWorkAggregators}/ResultAggregatorTest.php | 4 ++-- .../ActiveOnDateFilterTest.php | 4 ++-- .../ActiveOneDayBetweenDatesFilterTest.php | 4 ++-- .../ActivityTypeFilterTest.php | 4 ++-- .../AdministrativeLocationFilterTest.php | 4 ++-- .../ClosingMotiveFilterTest.php | 4 ++-- .../ConfidentialFilterTest.php | 4 ++-- .../CurrentUserJobFilterTest.php} | 6 +++--- .../CurrentUserScopeFilterTest.php} | 6 +++--- .../EmergencyFilterTest.php | 4 ++-- .../EvaluationFilterTest.php | 4 ++-- .../GeographicalUnitStatFilterTest.php | 4 ++-- .../IntensityFilterTest.php | 4 ++-- .../OpenBetweenDatesFilterTest.php | 4 ++-- .../{ => AccompanyingCourseFilters}/OriginFilterTest.php | 4 ++-- .../ReferrerFilterTest.php | 4 ++-- .../RequestorFilterTest.php | 4 ++-- .../SocialActionFilterTest.php | 4 ++-- .../SocialIssueFilterTest.php | 4 ++-- .../{ => AccompanyingCourseFilters}/StepFilterTest.php | 4 ++-- .../{ => PersonFilters}/AccompanyingPeriodFilterTest.php | 8 +++----- .../Filter/{ => PersonFilters}/BirthdayFilterTest.php | 8 +++----- .../Filter/{ => PersonFilters}/GenderFilterTest.php | 8 +++----- .../Filter/{ => SocialWorkFilters}/JobFilterTest.php | 3 ++- .../Filter/{ => SocialWorkFilters}/ScopeFilterTest.php | 3 ++- 32 files changed, 68 insertions(+), 72 deletions(-) rename src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/{ => PersonAggregators}/AgeAggregatorTest.php (89%) rename src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/{ => PersonAggregators}/GenderAggregatorTest.php (88%) rename src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/{ => PersonAggregators}/NationalityAggregatorTest.php (88%) rename src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/{ => SocialWorkAggregators}/ActionTypeAggregatorTest.php (87%) rename src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/{ => SocialWorkAggregators}/GoalAggregatorTest.php (88%) rename src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/{ => SocialWorkAggregators}/ReferrerAggregatorTest.php (88%) rename src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/{ => SocialWorkAggregators}/ResultAggregatorTest.php (88%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => AccompanyingCourseFilters}/ActiveOnDateFilterTest.php (90%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => AccompanyingCourseFilters}/ActiveOneDayBetweenDatesFilterTest.php (90%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => AccompanyingCourseFilters}/ActivityTypeFilterTest.php (92%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => AccompanyingCourseFilters}/AdministrativeLocationFilterTest.php (91%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => AccompanyingCourseFilters}/ClosingMotiveFilterTest.php (91%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => AccompanyingCourseFilters}/ConfidentialFilterTest.php (90%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{UserJobFilterTest.php => AccompanyingCourseFilters/CurrentUserJobFilterTest.php} (85%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{UserScopeFilterTest.php => AccompanyingCourseFilters/CurrentUserScopeFilterTest.php} (85%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => AccompanyingCourseFilters}/EmergencyFilterTest.php (90%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => AccompanyingCourseFilters}/EvaluationFilterTest.php (92%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => AccompanyingCourseFilters}/GeographicalUnitStatFilterTest.php (90%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => AccompanyingCourseFilters}/IntensityFilterTest.php (90%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => AccompanyingCourseFilters}/OpenBetweenDatesFilterTest.php (91%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => AccompanyingCourseFilters}/OriginFilterTest.php (92%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => AccompanyingCourseFilters}/ReferrerFilterTest.php (93%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => AccompanyingCourseFilters}/RequestorFilterTest.php (91%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => AccompanyingCourseFilters}/SocialActionFilterTest.php (92%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => AccompanyingCourseFilters}/SocialIssueFilterTest.php (92%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => AccompanyingCourseFilters}/StepFilterTest.php (91%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => PersonFilters}/AccompanyingPeriodFilterTest.php (94%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => PersonFilters}/BirthdayFilterTest.php (91%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => PersonFilters}/GenderFilterTest.php (91%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => SocialWorkFilters}/JobFilterTest.php (91%) rename src/Bundle/ChillPersonBundle/Tests/Export/Filter/{ => SocialWorkFilters}/ScopeFilterTest.php (91%) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php index 7a72179a8..a7c637bda 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php @@ -34,7 +34,7 @@ class MaritalStatusFilter implements FilterInterface $this->translatableStringHelper = $translatableStringHelper; } - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AgeAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/AgeAggregatorTest.php similarity index 89% rename from src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AgeAggregatorTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/AgeAggregatorTest.php index f858f248a..a0d869462 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AgeAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/AgeAggregatorTest.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Aggregator; +namespace Chill\PersonBundle\Tests\Export\Aggregator\PersonAggregators; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; use DateTime; @@ -21,7 +21,7 @@ use DateTime; final class AgeAggregatorTest extends AbstractAggregatorTest { /** - * @var \Chill\PersonBundle\Export\Aggregator\AgeAggregator + * @var \Chill\PersonBundle\Export\Aggregator\PersonAggregators\AgeAggregator */ private $aggregator; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/GenderAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/GenderAggregatorTest.php similarity index 88% rename from src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/GenderAggregatorTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/GenderAggregatorTest.php index f295aa78c..6389ac33d 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/GenderAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/GenderAggregatorTest.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Aggregator; +namespace Chill\PersonBundle\Tests\Export\Aggregator\PersonAggregators; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; @@ -20,7 +20,7 @@ use Chill\MainBundle\Test\Export\AbstractAggregatorTest; final class GenderAggregatorTest extends AbstractAggregatorTest { /** - * @var \Chill\PersonBundle\Export\Aggregator\GenderAggregator + * @var \Chill\PersonBundle\Export\Aggregator\PersonAggregators\GenderAggregator */ private $aggregator; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/NationalityAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/NationalityAggregatorTest.php similarity index 88% rename from src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/NationalityAggregatorTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/NationalityAggregatorTest.php index dd06135b9..c093d96cc 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/NationalityAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/PersonAggregators/NationalityAggregatorTest.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Aggregator; +namespace Chill\PersonBundle\Tests\Export\Aggregator\PersonAggregators; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; @@ -20,7 +20,7 @@ use Chill\MainBundle\Test\Export\AbstractAggregatorTest; final class NationalityAggregatorTest extends AbstractAggregatorTest { /** - * @var \Chill\PersonBundle\Export\Aggregator\NationalityAggregator + * @var \Chill\PersonBundle\Export\Aggregator\PersonAggregators\NationalityAggregator */ private $aggregator; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ActionTypeAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregatorTest.php similarity index 87% rename from src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ActionTypeAggregatorTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregatorTest.php index 235545e0f..ab0492d11 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ActionTypeAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregatorTest.php @@ -9,10 +9,10 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Aggregator; +namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; -use Chill\PersonBundle\Export\Aggregator\ActionTypeAggregator; +use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ActionTypeAggregator; /** * @internal diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/GoalAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/GoalAggregatorTest.php similarity index 88% rename from src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/GoalAggregatorTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/GoalAggregatorTest.php index 050b8ad5a..ef5bd5097 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/GoalAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/GoalAggregatorTest.php @@ -9,10 +9,10 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Aggregator; +namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; -use Chill\PersonBundle\Export\Aggregator\GoalAggregator; +use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\GoalAggregator; /** * @internal diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ReferrerAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ReferrerAggregatorTest.php similarity index 88% rename from src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ReferrerAggregatorTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ReferrerAggregatorTest.php index e4e0eace8..446cf1e37 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ReferrerAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ReferrerAggregatorTest.php @@ -9,10 +9,10 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Aggregator; +namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; -use Chill\PersonBundle\Export\Aggregator\ReferrerAggregator; +use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ReferrerAggregator; /** * @internal diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ResultAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ResultAggregatorTest.php similarity index 88% rename from src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ResultAggregatorTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ResultAggregatorTest.php index 3112fc2d4..a34a16a8a 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ResultAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/SocialWorkAggregators/ResultAggregatorTest.php @@ -9,10 +9,10 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Aggregator; +namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; -use Chill\PersonBundle\Export\Aggregator\ResultAggregator; +use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ResultAggregator; /** * @internal diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOnDateFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilterTest.php similarity index 90% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOnDateFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilterTest.php index 81c132f7c..3a8160cd2 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOnDateFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilterTest.php @@ -9,10 +9,10 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; -use Chill\PersonBundle\Export\Filter\ActiveOnDateFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ActiveOnDateFilter; use DateTime; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOneDayBetweenDatesFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilterTest.php similarity index 90% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOneDayBetweenDatesFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilterTest.php index ab173d0b1..30957879e 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOneDayBetweenDatesFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilterTest.php @@ -9,10 +9,10 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; -use Chill\PersonBundle\Export\Filter\ActiveOneDayBetweenDatesFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ActiveOneDayBetweenDatesFilter; use DateTime; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActivityTypeFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilterTest.php similarity index 92% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActivityTypeFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilterTest.php index f59039f35..bce092b6e 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActivityTypeFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilterTest.php @@ -9,11 +9,11 @@ declare(strict_types=1); -namespace Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\ActivityBundle\Entity\ActivityType; use Chill\MainBundle\Test\Export\AbstractFilterTest; -use Chill\PersonBundle\Export\Filter\ActivityTypeFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ActivityTypeFilter; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AdministrativeLocationFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilterTest.php similarity index 91% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/AdministrativeLocationFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilterTest.php index 190729161..c09c50fbc 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AdministrativeLocationFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilterTest.php @@ -9,11 +9,11 @@ declare(strict_types=1); -namespace Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters;; use Chill\MainBundle\Entity\Location; use Chill\MainBundle\Test\Export\AbstractFilterTest; -use Chill\PersonBundle\Export\Filter\AdministrativeLocationFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\AdministrativeLocationFilter; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ClosingMotiveFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilterTest.php similarity index 91% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/ClosingMotiveFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilterTest.php index d9403506d..8ff47ac6c 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ClosingMotiveFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilterTest.php @@ -9,11 +9,11 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive; -use Chill\PersonBundle\Export\Filter\ClosingMotiveFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ClosingMotiveFilter; use Doctrine\ORM\EntityManagerInterface; /** diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ConfidentialFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ConfidentialFilterTest.php similarity index 90% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/ConfidentialFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ConfidentialFilterTest.php index 6229989fe..db469bd49 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ConfidentialFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ConfidentialFilterTest.php @@ -9,10 +9,10 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; -use Chill\PersonBundle\Export\Filter\ConfidentialFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ConfidentialFilter; use Doctrine\ORM\EntityManagerInterface; /** diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserJobFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilterTest.php similarity index 85% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserJobFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilterTest.php index 3c91c8efa..77881a218 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserJobFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilterTest.php @@ -9,17 +9,17 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; -use Chill\PersonBundle\Export\Filter\UserJobFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\UserJobFilter; use Doctrine\ORM\EntityManagerInterface; /** * @internal * @coversNothing */ -final class UserJobFilterTest extends AbstractFilterTest +final class CurrentUserJobFilterTest extends AbstractFilterTest { private UserJobFilter $filter; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserScopeFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilterTest.php similarity index 85% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserScopeFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilterTest.php index 72d5eaf57..1ea4d40b0 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserScopeFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilterTest.php @@ -9,17 +9,17 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; -use Chill\PersonBundle\Export\Filter\UserScopeFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\UserScopeFilter; use Doctrine\ORM\EntityManagerInterface; /** * @internal * @coversNothing */ -final class UserScopeFilterTest extends AbstractFilterTest +final class CurrentUserScopeFilterTest extends AbstractFilterTest { private UserScopeFilter $filter; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/EmergencyFilterTest.php similarity index 90% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/EmergencyFilterTest.php index 7ed43ea65..5a7c1228f 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/EmergencyFilterTest.php @@ -9,10 +9,10 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; -use Chill\PersonBundle\Export\Filter\EmergencyFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\EmergencyFilter; use Doctrine\ORM\EntityManagerInterface; /** diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/EvaluationFilterTest.php similarity index 92% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/EvaluationFilterTest.php index a4e39792c..c3c25870d 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/EvaluationFilterTest.php @@ -9,11 +9,11 @@ declare(strict_types=1); -namespace Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; use Chill\PersonBundle\Entity\SocialWork\Evaluation; -use Chill\PersonBundle\Export\Filter\EvaluationFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\EvaluationFilter; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/GeographicalUnitStatFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilterTest.php similarity index 90% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/GeographicalUnitStatFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilterTest.php index a2eef9038..8baaf5df7 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/GeographicalUnitStatFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilterTest.php @@ -9,10 +9,10 @@ declare(strict_types=1); -namespace Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; -use Chill\PersonBundle\Export\Filter\GeographicalUnitStatFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\GeographicalUnitStatFilter; use DateTime; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/IntensityFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/IntensityFilterTest.php similarity index 90% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/IntensityFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/IntensityFilterTest.php index 65d2c6880..6319b2acf 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/IntensityFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/IntensityFilterTest.php @@ -9,10 +9,10 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; -use Chill\PersonBundle\Export\Filter\IntensityFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\IntensityFilter; use Doctrine\ORM\EntityManagerInterface; /** diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OpenBetweenDatesFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilterTest.php similarity index 91% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/OpenBetweenDatesFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilterTest.php index 5e4ae3d0a..5334c17f8 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OpenBetweenDatesFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilterTest.php @@ -9,10 +9,10 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; -use Chill\PersonBundle\Export\Filter\OpenBetweenDatesFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\OpenBetweenDatesFilter; use DateTime; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OriginFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/OriginFilterTest.php similarity index 92% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/OriginFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/OriginFilterTest.php index f37cebc72..745e62ca6 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OriginFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/OriginFilterTest.php @@ -9,11 +9,11 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin; -use Chill\PersonBundle\Export\Filter\OriginFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\OriginFilter; use Doctrine\ORM\EntityManagerInterface; /** diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ReferrerFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterTest.php similarity index 93% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/ReferrerFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterTest.php index 84340e267..a332c89dc 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ReferrerFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterTest.php @@ -9,11 +9,11 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Test\Export\AbstractFilterTest; -use Chill\PersonBundle\Export\Filter\ReferrerFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ReferrerFilter; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/RequestorFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/RequestorFilterTest.php similarity index 91% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/RequestorFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/RequestorFilterTest.php index 50dcb20f5..d936f09ae 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/RequestorFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/RequestorFilterTest.php @@ -9,10 +9,10 @@ declare(strict_types=1); -namespace Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; -use Chill\PersonBundle\Export\Filter\RequestorFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\RequestorFilter; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialActionFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialActionFilterTest.php similarity index 92% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialActionFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialActionFilterTest.php index c7834a33a..39321dad1 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialActionFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialActionFilterTest.php @@ -9,11 +9,11 @@ declare(strict_types=1); -namespace Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; use Chill\PersonBundle\Entity\SocialWork\SocialAction; -use Chill\PersonBundle\Export\Filter\SocialActionFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\SocialActionFilter; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialIssueFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialIssueFilterTest.php similarity index 92% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialIssueFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialIssueFilterTest.php index 16e77381f..a7815d3ed 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialIssueFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/SocialIssueFilterTest.php @@ -9,11 +9,11 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; use Chill\PersonBundle\Entity\SocialWork\SocialIssue; -use Chill\PersonBundle\Export\Filter\SocialIssueFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\SocialIssueFilter; use Doctrine\ORM\EntityManagerInterface; /** diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/StepFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/StepFilterTest.php similarity index 91% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/StepFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/StepFilterTest.php index ac75b2123..e9353b461 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/StepFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/StepFilterTest.php @@ -9,11 +9,11 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; use Chill\PersonBundle\Entity\AccompanyingPeriod; -use Chill\PersonBundle\Export\Filter\StepFilter; +use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\StepFilter; /** * @internal diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/AccompanyingPeriodFilterTest.php similarity index 94% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/AccompanyingPeriodFilterTest.php index 2b0ea2788..fb975000a 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingPeriodFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/AccompanyingPeriodFilterTest.php @@ -9,9 +9,10 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\PersonFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; +use Chill\PersonBundle\Export\Filter\PersonFilters\BirthdateFilter; use DateTime; use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; @@ -21,10 +22,7 @@ use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; */ final class AccompanyingPeriodFilterTest extends AbstractFilterTest { - /** - * @var \Chill\PersonBundle\Export\Filter\BirthdateFilter - */ - private $filter; + private BirthdateFilter $filter; protected function setUp(): void { diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/BirthdayFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/BirthdayFilterTest.php similarity index 91% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/BirthdayFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/BirthdayFilterTest.php index 18eda9071..4ff4f5ce3 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/BirthdayFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/BirthdayFilterTest.php @@ -9,9 +9,10 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\PersonFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; +use Chill\PersonBundle\Export\Filter\PersonFilters\BirthdateFilter; use DateTime; /** @@ -20,10 +21,7 @@ use DateTime; */ final class BirthdayFilterTest extends AbstractFilterTest { - /** - * @var \Chill\PersonBundle\Export\Filter\BirthdateFilter - */ - private $filter; + private BirthdateFilter $filter; protected function setUp(): void { diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/GenderFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/GenderFilterTest.php similarity index 91% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/GenderFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/GenderFilterTest.php index 7e7a584cb..8ce02a653 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/GenderFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/PersonFilters/GenderFilterTest.php @@ -9,10 +9,11 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\PersonFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; use Chill\PersonBundle\Entity\Person; +use Chill\PersonBundle\Export\Filter\PersonFilters\GenderFilter; /** * @internal @@ -20,10 +21,7 @@ use Chill\PersonBundle\Entity\Person; */ final class GenderFilterTest extends AbstractFilterTest { - /** - * @var \Chill\PersonBundle\Export\Filter\GenderFilter - */ - private $filter; + private GenderFilter $filter; protected function setUp(): void { diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/JobFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/JobFilterTest.php similarity index 91% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/JobFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/JobFilterTest.php index 9a9bb2498..5116af979 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/JobFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/JobFilterTest.php @@ -9,9 +9,10 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\SocialWorkFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; +use Chill\PersonBundle\Export\Filter\SocialWorkFilters\JobFilter; use Doctrine\ORM\EntityManagerInterface; /** diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ScopeFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/ScopeFilterTest.php similarity index 91% rename from src/Bundle/ChillPersonBundle/Tests/Export/Filter/ScopeFilterTest.php rename to src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/ScopeFilterTest.php index 1269f0372..b12eb4e5b 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ScopeFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialWorkFilters/ScopeFilterTest.php @@ -9,9 +9,10 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Tests\Export\Filter; +namespace Chill\PersonBundle\Tests\Export\Filter\SocialWorkFilters; use Chill\MainBundle\Test\Export\AbstractFilterTest; +use Chill\PersonBundle\Export\Filter\SocialWorkFilters\ScopeFilter; use Doctrine\ORM\EntityManagerInterface; /** From d9e602247e7e80884277dea7dc15453c1a7ec876 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 7 Sep 2022 11:09:03 +0200 Subject: [PATCH 14/18] fix errors with Role type --- src/Bundle/ChillMainBundle/Export/ExportManager.php | 4 ++-- .../GeographicalUnitStatAggregator.php | 2 +- .../ChillPersonBundle/Export/Export/ListPersonDuplicate.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Export/ExportManager.php b/src/Bundle/ChillMainBundle/Export/ExportManager.php index 9ba9bc1a8..788fae719 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportManager.php +++ b/src/Bundle/ChillMainBundle/Export/ExportManager.php @@ -559,13 +559,13 @@ class ExportManager } foreach ($centers as $center) { - if ($this->authorizationChecker->isGranted($role->getRole(), $center) === false) { + if ($this->authorizationChecker->isGranted($role, $center) === false) { //debugging $this->logger->debug('user has no access to element', [ 'method' => __METHOD__, 'type' => get_class($element), 'center' => $center->getName(), - 'role' => $role->getRole(), + 'role' => $role, ]); ///// Bypasse les autorisations qui empêche d'afficher les nouveaux exports diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php index ed5d80ae8..18a1b3dea 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php @@ -64,7 +64,7 @@ final class GeographicalUnitStatAggregator implements AggregatorInterface /** * @inheritDoc */ - public function addRole() + public function addRole(): ?string { return null; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php index 7f8688493..75d757f9e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php @@ -142,9 +142,9 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat return 'List duplicates'; } - public function requiredRole(): Role + public function requiredRole(): string { - return new Role(PersonVoter::DUPLICATE); + return PersonVoter::DUPLICATE; } public function validateForm($data, ExecutionContextInterface $context) From 482abd3980c04f4ce5b2dd96bd1ce7f35e55cc09 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 7 Sep 2022 12:23:38 +0200 Subject: [PATCH 15/18] remove dump --- .../Filter/AccompanyingCourseFilters/ConfidentialFilter.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php index 3ebf77182..4d1784cb3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php @@ -73,8 +73,6 @@ class ConfidentialFilter implements FilterInterface public function describeAction($data, $format = 'string'): array { - dump($data, self::CHOICES); - foreach (self::CHOICES as $k => $v) { if ($v === $data['accepted_confidentials']) { $choice = $k; From 3851e65777d157dd4c1317ef92624aeb553d6c66 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 7 Sep 2022 13:38:13 +0200 Subject: [PATCH 16/18] fix errors with Role type --- src/Bundle/ChillMainBundle/Export/ExportManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Export/ExportManager.php b/src/Bundle/ChillMainBundle/Export/ExportManager.php index 788fae719..e2d099ba8 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportManager.php +++ b/src/Bundle/ChillMainBundle/Export/ExportManager.php @@ -594,7 +594,7 @@ class ExportManager 'center' => $center, 'circles' => $this->authorizationHelper->getReachableScopes( $this->user, - $element->requiredRole()->getRole(), + $element->requiredRole(), $center ), ]; From 81359877c43db4ec80d094ea42a073938758648d Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 7 Sep 2022 19:35:07 +0200 Subject: [PATCH 17/18] exports: add condition with distinct alias on join clauses (wip) --- .../Aggregator/ActivityTypeAggregator.php | 4 +-- .../AdministrativeLocationAggregator.php | 4 ++- .../ClosingMotiveAggregator.php | 4 ++- .../EvaluationAggregator.php | 7 ++++-- .../JobAggregator.php | 4 ++- .../OriginAggregator.php | 4 ++- .../ReferrerAggregator.php | 6 +++-- .../RequestorAggregator.php | 6 ++--- .../ScopeAggregator.php | 6 +++-- .../SocialIssueAggregator.php | 7 ++++-- .../HouseholdPositionAggregator.php | 19 ++++++++------ .../Export/Export/CountEvaluation.php | 14 ++++++++--- .../Export/Export/CountHousehold.php | 25 ++++++++++++++----- .../CountPersonWithAccompanyingCourse.php | 14 ++++++++--- .../Export/Export/CountSocialWorkActions.php | 7 ++++-- .../ActivityTypeFilter.php | 6 ++--- .../CurrentUserScopeFilter.php | 6 +++-- .../EvaluationFilter.php | 17 +++++++++---- .../RequestorFilter.php | 17 ++++++++----- .../SocialActionFilter.php | 5 +++- .../SocialIssueFilter.php | 6 +++-- 21 files changed, 129 insertions(+), 59 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php index d318d969a..f31e2e73f 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php @@ -44,8 +44,8 @@ class ActivityTypeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('type', $qb->getAllAliases(), true)) { - $qb->join('activity.activityType', 'type'); + if (!in_array('aty', $qb->getAllAliases(), true)) { + $qb->join('activity.activityType', 'aty'); } $qb->addSelect(sprintf('IDENTITY(activity.activityType) AS %s', self::KEY)); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php index a1cf7160b..13185c2a2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php @@ -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'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php index b0f8f98f0..033ba4365 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php @@ -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'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php index 96c63b9cf..120506aae 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php @@ -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'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php index 6443cc02e..7634ea37f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php @@ -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'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php index b98edae32..4c784e08d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php @@ -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'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php index a1df6b559..22eca6f76 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php @@ -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'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php index 26d5fad53..80195bdcc 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php @@ -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 ) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php index c7b3142f2..5b2901921 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php @@ -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'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php index 7cb726673..ac5ac94c0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php @@ -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'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php index ea94e891b..b63d3842f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php @@ -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'); diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php index e931a1a42..5b2ab65eb 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php @@ -88,11 +88,17 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - $qb = $this->repository->createQueryBuilder('acp') - ->join('acp.works', 'acpw') - ->join('acpw.accompanyingPeriodWorkEvaluations', 'eval'); + $qb = $this->repository->createQueryBuilder('acp'); - $qb->select('COUNT(eval.id) AS export_result'); + if (!in_array('acpw', $qb->getAllAliases(), true)) { + $qb->join('acp.works', 'acpw'); + } + + if (!in_array('workeval', $qb->getAllAliases(), true)) { + $qb->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval'); + } + + $qb->select('COUNT(workeval.id) AS export_result'); return $qb; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php index a79c1c00e..f60f66310 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php @@ -88,13 +88,26 @@ class CountHousehold implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - $qb = $this->repository->createQueryBuilder('acp') - ->join('acp.participations', 'acppart') - ->join('acppart.person', 'person') - ->join('person.householdParticipations', 'householdmember') - ->join('householdmember.household', 'household'); + $qb = $this->repository->createQueryBuilder('acp'); - $qb->select('COUNT(DISTINCT householdmember.household) AS export_result'); + if (!in_array('acppart', $qb->getAllAliases(), true)) { + $qb->join('acp.participations', 'acppart'); + } + + if (!in_array('partperson', $qb->getAllAliases(), true)) { + $qb->join('acppart.person', 'partperson'); + } + + if (!in_array('member', $qb->getAllAliases(), true)) { + $qb->join('partperson.householdParticipations', 'member'); + } + + if (!in_array('household', $qb->getAllAliases(), true)) { + $qb->join('member.household', 'household'); + } + + + $qb->select('COUNT(DISTINCT member.household) AS export_result'); return $qb; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php index 4de0eb191..800023fc5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php @@ -88,11 +88,17 @@ class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExpor public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - $qb = $this->repository->createQueryBuilder('acp') - ->join('acp.participations', 'acppart') - ->join('acppart.person', 'person'); + $qb = $this->repository->createQueryBuilder('acp'); - $qb->select('COUNT(DISTINCT person.id) AS export_result'); + if (!in_array('acppart', $qb->getAllAliases(), true)) { + $qb->join('acp.participations', 'acppart'); + } + + if (!in_array('partperson', $qb->getAllAliases(), true)) { + $qb->join('acppart.person', 'partperson'); + } + + $qb->select('COUNT(DISTINCT partperson.id) AS export_result'); return $qb; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php index 1a856e23d..17de7e5ae 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php @@ -90,8 +90,11 @@ class CountSocialWorkActions implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder { - $qb = $this->repository->createQueryBuilder('acp') - ->join('acp.works', 'acpw'); + $qb = $this->repository->createQueryBuilder('acp'); + + if (!in_array('acpw', $qb->getAllAliases(), true)) { + $qb->join('acp.works', 'acpw'); + } $qb->select('COUNT(acpw.id) as export_result'); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php index 845b318b9..2659172a4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php @@ -43,11 +43,11 @@ class ActivityTypeFilter implements FilterInterface // we replace indicator 'from' clause by 'act', and put 'acp' in a join $qb->resetDQLPart('from'); - $qb->from('ChillActivityBundle:Activity', 'act'); + $qb->from('ChillActivityBundle:Activity', 'activity'); $qb - ->join('act.accompanyingPeriod', 'acp') - ->join('act.activityType', 'aty'); + ->join('activity.accompanyingPeriod', 'acp') + ->join('activity.activityType', 'aty'); $where = $qb->getDQLPart('where'); $clause = $qb->expr()->in('aty.id', ':activitytypes'); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php index cbbd9bef5..569146614 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php @@ -42,10 +42,12 @@ class CurrentUserScopeFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acp.scopes', 's'); + if (!in_array('acpscope', $qb->getAllAliases(), true)) { + $qb->join('acp.scopes', 'acpscope'); + } $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->eq('s.id', ':userscope'); + $clause = $qb->expr()->eq('acpscope.id', ':userscope'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php index 7df43a06f..c04d5bcd0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php @@ -37,13 +37,20 @@ class EvaluationFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb - ->join('acp.works', 'acpw') - ->join('acpw.accompanyingPeriodWorkEvaluations', 'we') - ->join('we.evaluation', 'ev'); + if (!in_array('acpw', $qb->getAllAliases(), true)) { + $qb->join('acp.works', 'acpw'); + } + + if (!in_array('workeval', $qb->getAllAliases(), true)) { + $qb->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval'); + } + + if (!in_array('eval', $qb->getAllAliases(), true)) { + $qb->join('workeval.evaluation', 'eval'); + } $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('ev.id', ':evaluations'); + $clause = $qb->expr()->in('eval.id', ':evaluations'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php index 6bcf359ae..c0338b42e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php @@ -55,11 +55,14 @@ final class RequestorFilter implements FilterInterface switch ($data['accepted_choices']) { case 'participation': - $qb->join('acp.participations', 'part'); + + if (!in_array('acppart', $qb->getAllAliases(), true)) { + $qb->join('acp.participations', 'acppart'); + } $clause = $qb->expr()->andX( $qb->expr()->isNotNull('acp.requestorPerson'), - $qb->expr()->eq('acp.requestorPerson', 'part.person') + $qb->expr()->eq('acp.requestorPerson', 'acppart.person') ); break; @@ -67,7 +70,9 @@ final class RequestorFilter implements FilterInterface case 'other_person': $expr = $this->em->getExpressionBuilder(); - $qb->join('acp.participations', 'part'); + if (!in_array('acppart', $qb->getAllAliases(), true)) { + $qb->join('acp.participations', 'acppart'); + } $clause = $expr->andX( $expr->isNotNull('acp.requestorPerson'), @@ -76,10 +81,10 @@ final class RequestorFilter implements FilterInterface // subquery $this->em->createQueryBuilder() - ->select('identity(acp2.requestorPerson)') ->from('ChillPersonBundle:AccompanyingPeriod', 'acp2') - ->join('acp2.participations', 'part2') - ->where($expr->eq('acp2.requestorPerson', 'part2.person')) + ->join('acp2.participations', 'acppart2') + ->select('identity(acp2.requestorPerson)') + ->where($expr->eq('acp2.requestorPerson', 'acppart2.person')) ->getDQL() ) ); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php index 50889225c..c0eb98513 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php @@ -46,7 +46,10 @@ class SocialActionFilter implements FilterInterface if (!in_array('acpw', $qb->getAllAliases(), true)) { $qb->join('acp.works', 'acpw'); } - $qb->join('acpw.socialAction', 'sa'); + + if (!in_array('acpw', $qb->getAllAliases(), true)) { + $qb->join('acpw.socialAction', 'sa'); + } $where = $qb->getDQLPart('where'); $clause = $qb->expr()->in('sa.id', ':socialactions'); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php index fdcb15ee7..ad232d7c2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php @@ -50,10 +50,12 @@ class SocialIssueFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acp.socialIssues', 'si'); + if (!in_array('acpsocialissue', $qb->getAllAliases(), true)) { + $qb->join('acp.socialIssues', 'acpsocialissue'); + } $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('si.id', ':socialissues'); + $clause = $qb->expr()->in('acpsocialissue.id', ':socialissues'); if ($where instanceof Andx) { $where->add($clause); From 1dcff2f23cd4fe9124a18463c4ada67c976b8a2a Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 7 Sep 2022 19:58:38 +0200 Subject: [PATCH 18/18] exports: add condition with distinct alias on join clauses --- exports_alias_conventions.csv | 68 +++++++++++++++++ exports_alias_conventions.md | 76 +++++++++++++++++++ .../BySocialActionAggregator.php | 6 +- .../BySocialIssueAggregator.php | 6 +- .../ACPAggregators/ByThirdpartyAggregator.php | 6 +- .../ACPAggregators/ByUserAggregator.php | 6 +- .../ACPAggregators/LocationTypeAggregator.php | 6 +- .../ACPAggregators/UserScopeAggregator.php | 6 +- .../Aggregator/ActivityTypeAggregator.php | 23 +----- .../ActivityReasonAggregator.php | 41 +--------- .../LinkedToACP/AvgActivityDuration.php | 2 +- .../LinkedToACP/AvgActivityVisitDuration.php | 2 +- .../Export/LinkedToACP/CountActivity.php | 7 +- .../LinkedToACP/SumActivityDuration.php | 7 +- .../LinkedToACP/SumActivityVisitDuration.php | 7 +- .../Export/LinkedToPerson/CountActivity.php | 7 +- .../Export/LinkedToPerson/ListActivity.php | 10 +-- .../LinkedToPerson/StatActivityDuration.php | 6 +- .../ACPFilters/BySocialActionFilter.php | 6 +- .../Filter/ACPFilters/BySocialIssueFilter.php | 6 +- .../Export/Filter/ACPFilters/ByUserFilter.php | 6 +- .../Filter/ACPFilters/LocationTypeFilter.php | 6 +- .../Filter/ACPFilters/UserScopeFilter.php | 6 +- .../Export/Filter/ActivityTypeFilter.php | 19 ----- .../PersonFilters/ActivityReasonFilter.php | 34 +-------- .../Export/Aggregator/AgentAggregator.php | 6 +- .../Aggregator/CancelReasonAggregator.php | 4 +- .../Export/Aggregator/JobAggregator.php | 6 +- .../Export/Aggregator/LocationAggregator.php | 4 +- .../Aggregator/LocationTypeAggregator.php | 6 +- .../Export/Aggregator/ScopeAggregator.php | 6 +- .../Export/Filter/JobFilter.php | 6 +- .../Export/Filter/ScopeFilter.php | 6 +- .../HouseholdPositionAggregator.php | 8 +- .../MaritalStatusAggregator.php | 7 +- .../ActionTypeAggregator.php | 7 +- .../SocialWorkAggregators/GoalAggregator.php | 7 +- .../SocialWorkAggregators/JobAggregator.php | 6 +- .../ReferrerAggregator.php | 6 +- .../ResultAggregator.php | 17 ++++- .../SocialWorkAggregators/ScopeAggregator.php | 6 +- .../ActivityTypeFilter.php | 12 ++- .../SocialActionFilter.php | 6 +- .../ResidentialAddressAtThirdpartyFilter.php | 27 +++++-- .../ResidentialAddressAtUserFilter.php | 13 +++- .../Filter/SocialWorkFilters/JobFilter.php | 6 +- .../SocialWorkFilters/ReferrerFilter.php | 6 +- .../Filter/SocialWorkFilters/ScopeFilter.php | 6 +- .../ReferrerFilterTest.php | 4 +- 49 files changed, 343 insertions(+), 220 deletions(-) create mode 100644 exports_alias_conventions.csv create mode 100644 exports_alias_conventions.md diff --git a/exports_alias_conventions.csv b/exports_alias_conventions.csv new file mode 100644 index 000000000..1215479d8 --- /dev/null +++ b/exports_alias_conventions.csv @@ -0,0 +1,68 @@ +Entity,Join,Attribute,Alias +AccompanyingPeriod::class,,,acp +,AccompanyingPeriodWork::class,acp.works,acpw +,AccompanyingPeriodParticipation::class,acp.participations,acppart +,Location::class,acp.administrativeLocation,acploc +,ClosingMotive::class,acp.closingMotive,acpmotive +,UserJob::class,acp.job,acpjob +,Origin::class,acp.origin,acporigin +,Scope::class,acp.scopes,acpscope +,SocialIssue::class,acp.socialIssues,acpsocialissue +,User::class,acp.user,acpuser +AccompanyingPeriodWork::class,,,acpw +,AccompanyingPeriodWorkEvaluation::class,acpw.accompanyingPeriodWorkEvaluations,workeval +,Goal::class,acpw.goals,goal +,User::class,acpw.referrers,acpwuser +,Result::class,acpw.results,acpwresult +,SocialAction::class,acpw.socialAction,acpwsocialaction +AccompanyingPeriodParticipation::class,,,acppart +,Person::class,acppart.person,partperson +AccompanyingPeriodWorkEvaluation::class,,,workeval +,Evaluation::class,workeval.evaluation,eval +Goal::class,,,goal +,Result::class,goal.results,goalresult +Person::class,,,person +,Center::class,person.center,center +,HouseholdMember::class,partperson.householdParticipations,member +,MaritalStatus::class,person.maritalStatus,personmarital +ResidentialAddress::class,,,resaddr +,Person::class,resaddr.person,resaddrperson +,Center::class,resaddrperson.center,resaddrcenter +,ThirdParty::class,resaddr.hostThirdParty,tparty +ThirdParty::class,,,tparty +,ThirdPartyCategory::class,tparty.categories,tpartycat +HouseholdMember::class,,,member +,Household::class,member.household,household +,Person::class,member.person,memberperson +,,memberperson.center,membercenter +Household::class,,,household +,HouseholdComposition::class,household.compositions,composition +Activity::class,,,activity +,Person::class,activity.person,actperson +,AccompanyingPeriod::class,activity.accompanyingPeriod,actacp +,Person::class,activity_person_having_activity.person,person_person_having_activity +,ActivityReason::class,activity_person_having_activity.reasons,reasons_person_having_activity +,ActivityType::class,activity.activityType,acttype +,Location::class,activity.location,actloc +,SocialAction::class,activity.socialActions,actsocialaction +,SocialIssue::class,activity.socialIssues,actsocialssue +,ThirdParty::class,activity.thirdParties,acttparty +,User::class,activity.user,actuser +,User::class,activity.users,actusers +,ActivityReason::class,activity.reasons,actreasons +,Center::class,actperson.center,actcenter +ActivityReason::class,,,actreasons +,ActivityReasonCategory::class,actreason.category,actreasoncat +Calendar::class,,,cal +,CancelReason::class,cal.cancelReason,calcancel +,Location::class,cal.location,calloc +,User::class,cal.user,caluser +VendeePerson::class,,,vp +,Person::class,vp.person,vpperson +,Center::class,vpperson.center,vpcenter +,SituationProfessionelle::class,vp.situationProfessionelle,vpprof +,StatutLogement::class,vp.statutLogement,vplog +,TempsDeTravail::class,vp.tempsDeTravail,vptt +VendeePersonMineur::class,,,vpm +,Person::class,vpm.person,vpmperson +,Center::class,vpmperson.center,vpmcenter diff --git a/exports_alias_conventions.md b/exports_alias_conventions.md new file mode 100644 index 000000000..85973eec1 --- /dev/null +++ b/exports_alias_conventions.md @@ -0,0 +1,76 @@ +# Export conventions + + +Add condition with distinct alias on each export join clauses (Indicators + Filters + Aggregators) + +These are alias conventions : + +| Entity | Join | Attribute | Alias | +| :--- | :--- |:-------------------------------------------|:----------------------------------| +| AccompanyingPeriod::class | | | acp | +| | AccompanyingPeriodWork::class | acp.works | acpw | +| | AccompanyingPeriodParticipation::class | acp.participations | acppart | +| | Location::class | acp.administrativeLocation | acploc | +| | ClosingMotive::class | acp.closingMotive | acpmotive | +| | UserJob::class | acp.job | acpjob | +| | Origin::class | acp.origin | acporigin | +| | Scope::class | acp.scopes | acpscope | +| | SocialIssue::class | acp.socialIssues | acpsocialissue | +| | User::class | acp.user | acpuser | +| AccompanyingPeriodWork::class | | | acpw | +| | AccompanyingPeriodWorkEvaluation::class | acpw.accompanyingPeriodWorkEvaluations | workeval | +| | Goal::class | acpw.goals | goal | +| | User::class | acpw.referrers | acpwuser | +| | Result::class | acpw.results | acpwresult | +| | SocialAction::class | acpw.socialAction | acpwsocialaction | +| AccompanyingPeriodParticipation::class | | | acppart | +| | Person::class | acppart.person | partperson | +| AccompanyingPeriodWorkEvaluation::class | | | workeval | +| | Evaluation::class | workeval.evaluation | eval | +| Goal::class | | | goal | +| | Result::class | goal.results | goalresult | +| Person::class | | | person | +| | Center::class | person.center | center | +| | HouseholdMember::class | partperson.householdParticipations | member | +| | MaritalStatus::class | person.maritalStatus | personmarital | +| ResidentialAddress::class | | | resaddr | +| | Person::class | resaddr.person | resaddrperson | +| | Center::class | resaddrperson.center | resaddrcenter | +| | ThirdParty::class | resaddr.hostThirdParty | tparty | +| ThirdParty::class | | | tparty | +| | ThirdPartyCategory::class | tparty.categories | tpartycat | +| HouseholdMember::class | | | member | +| | Household::class | member.household | household | +| | Person::class | member.person | memberperson | +| | | memberperson.center | membercenter | +| Household::class | | | household | +| | HouseholdComposition::class | household.compositions | composition | +| Activity::class | | | activity | +| | Person::class | activity.person | actperson | +| | AccompanyingPeriod::class | activity.accompanyingPeriod | actacp | +| | Person::class | activity\_person\_having\_activity.person | person\_person\_having\_activity | +| | ActivityReason::class | activity\_person\_having\_activity.reasons | reasons\_person\_having\_activity | +| | ActivityType::class | activity.activityType | acttype | +| | Location::class | activity.location | actloc | +| | SocialAction::class | activity.socialActions | actsocialaction | +| | SocialIssue::class | activity.socialIssues | actsocialssue | +| | ThirdParty::class | activity.thirdParties | acttparty | +| | User::class | activity.user | actuser | +| | User::class | activity.users | actusers | +| | ActivityReason::class | activity.reasons | actreasons | +| | Center::class | actperson.center | actcenter | +| ActivityReason::class | | | actreasons | +| | ActivityReasonCategory::class | actreason.category | actreasoncat | +| Calendar::class | | | cal | +| | CancelReason::class | cal.cancelReason | calcancel | +| | Location::class | cal.location | calloc | +| | User::class | cal.user | caluser | +| VendeePerson::class | | | vp | +| | Person::class | vp.person | vpperson | +| | Center::class | vpperson.center | vpcenter | +| | SituationProfessionelle::class | vp.situationProfessionelle | vpprof | +| | StatutLogement::class | vp.statutLogement | vplog | +| | TempsDeTravail::class | vp.tempsDeTravail | vptt | +| VendeePersonMineur::class | | | vpm | +| | Person::class | vpm.person | vpmperson | +| | Center::class | vpmperson.center | vpmcenter | diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php index 19299eb6a..f35fe6e6b 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php @@ -40,11 +40,11 @@ class BySocialActionAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('socialaction', $qb->getAllAliases(), true)) { - $qb->join('activity.socialActions', 'socialaction'); + if (!in_array('actsocialaction', $qb->getAllAliases(), true)) { + $qb->join('activity.socialActions', 'actsocialaction'); } - $qb->addSelect('socialaction.id AS socialaction_aggregator'); + $qb->addSelect('actsocialaction.id AS socialaction_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php index 672076693..1126b9373 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php @@ -40,11 +40,11 @@ class BySocialIssueAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('socialissue', $qb->getAllAliases(), true)) { - $qb->join('activity.socialIssues', 'socialissue'); + if (!in_array('actsocialissue', $qb->getAllAliases(), true)) { + $qb->join('activity.socialIssues', 'actsocialissue'); } - $qb->addSelect('socialissue.id AS socialissue_aggregator'); + $qb->addSelect('actsocialissue.id AS socialissue_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php index 81822e801..4b56c6fc7 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php @@ -40,11 +40,11 @@ class ByThirdpartyAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('thirdparty', $qb->getAllAliases(), true)) { - $qb->join('activity.thirdParties', 'thirdparty'); + if (!in_array('acttparty', $qb->getAllAliases(), true)) { + $qb->join('activity.thirdParties', 'acttparty'); } - $qb->addSelect('thirdparty.id AS thirdparty_aggregator'); + $qb->addSelect('acttparty.id AS thirdparty_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php index 55df3febd..3787e5286 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php @@ -40,11 +40,11 @@ class ByUserAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('user', $qb->getAllAliases(), true)) { - $qb->join('activity.users', 'user'); + if (!in_array('actusers', $qb->getAllAliases(), true)) { + $qb->join('activity.users', 'actusers'); } - $qb->addSelect('user.id AS users_aggregator'); + $qb->addSelect('actusers.id AS users_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php index 9664060da..d05c0eb41 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php @@ -40,11 +40,11 @@ class LocationTypeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('location', $qb->getAllAliases(), true)) { - $qb->join('activity.location', 'location'); + if (!in_array('actloc', $qb->getAllAliases(), true)) { + $qb->join('activity.location', 'actloc'); } - $qb->addSelect('IDENTITY(location.locationType) AS locationtype_aggregator'); + $qb->addSelect('IDENTITY(actloc.locationType) AS locationtype_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/UserScopeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/UserScopeAggregator.php index c05196375..faaa08b8e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/UserScopeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/UserScopeAggregator.php @@ -40,11 +40,11 @@ class UserScopeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('user', $qb->getAllAliases(), true)) { - $qb->join('activity.user', 'user'); + if (!in_array('actuser', $qb->getAllAliases(), true)) { + $qb->join('activity.user', 'actuser'); } - $qb->addSelect('IDENTITY(user.mainScope) AS userscope_aggregator'); + $qb->addSelect('IDENTITY(actuser.mainScope) AS userscope_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php index f31e2e73f..5c285ca3e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php @@ -44,8 +44,8 @@ class ActivityTypeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('aty', $qb->getAllAliases(), true)) { - $qb->join('activity.activityType', 'aty'); + if (!in_array('acttype', $qb->getAllAliases(), true)) { + $qb->join('activity.activityType', 'acttype'); } $qb->addSelect(sprintf('IDENTITY(activity.activityType) AS %s', self::KEY)); @@ -94,23 +94,4 @@ class ActivityTypeAggregator implements AggregatorInterface { return 'Aggregate by activity type'; } - - /** - * Check if a join between Activity and another alias. - * - * @param Join[] $joins - * @param string $alias the alias to search for - * - * @return bool - */ - private function checkJoinAlreadyDefined(array $joins, $alias) - { - foreach ($joins as $join) { - if ($join->getAlias() === $alias) { - return true; - } - } - - return false; - } } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php index 83347bf11..9d7cd3116 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php @@ -67,29 +67,15 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali $qb->addSelect($elem . ' as ' . $alias); // make a jointure only if needed - $join = $qb->getDQLPart('join'); - - if ( - ( - array_key_exists('activity', $join) - && !$this->checkJoinAlreadyDefined($join['activity'], 'reasons') - ) - || (!array_key_exists('activity', $join)) - ) { - $qb->add( - 'join', - [ - 'activity' => new Join(Join::INNER_JOIN, 'activity.reasons', 'reasons'), - ], - true - ); + if (!in_array( 'actreasons', $qb->getAllAliases(), true)) { + $qb->innerJoin('activity.reasons', 'actreasons'); } // join category if necessary if ('activity_categories_id' === $alias) { // add join only if needed - if (!$this->checkJoinAlreadyDefined($qb->getDQLPart('join')['activity'], 'category')) { - $qb->join('reasons.category', 'category'); + if (!in_array('actreasoncat', $qb->getAllAliases(), true)) { + $qb->join('actreasons.category', 'actreasoncat'); } } @@ -193,23 +179,4 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali ->addViolation(); } } - - /** - * Check if a join between Activity and another alias. - * - * @param Join[] $joins - * @param string $alias the alias to search for - * - * @return bool - */ - private function checkJoinAlreadyDefined(array $joins, $alias) - { - foreach ($joins as $join) { - if ($join->getAlias() === $alias) { - return true; - } - } - - return false; - } } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php index 90fc7822b..be20d2b9c 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php @@ -84,7 +84,7 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { $qb = $this->repository->createQueryBuilder('activity') - ->join('activity.accompanyingPeriod', 'acp'); + ->join('activity.accompanyingPeriod', 'actacp'); $qb->select('AVG(activity.durationTime) as export_avg_activity_duration'); diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php index 02ad4a5e3..021c82d72 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php @@ -84,7 +84,7 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { $qb = $this->repository->createQueryBuilder('activity') - ->join('activity.accompanyingPeriod', 'acp'); + ->join('activity.accompanyingPeriod', 'actacp'); $qb->select('AVG(activity.travelTime) as export_avg_activity_visit_duration'); diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php index aaf8c9463..1f8b742dd 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php @@ -84,8 +84,11 @@ class CountActivity implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - $qb = $this->repository->createQueryBuilder('activity') - ->join('activity.accompanyingPeriod', 'acp'); + $qb = $this->repository->createQueryBuilder('activity'); + + if (!in_array('actacp', $qb->getAllAliases(), true)) { + $qb->join('activity.accompanyingPeriod', 'actacp'); + } $qb->select('COUNT(activity.id) as export_count_activity'); diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php index d11a7ded0..4d9b43034 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php @@ -83,8 +83,11 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - $qb = $this->repository->createQueryBuilder('activity') - ->join('activity.accompanyingPeriod', 'acp'); + $qb = $this->repository->createQueryBuilder('activity'); + + if (!in_array('actacp', $qb->getAllAliases(), true)) { + $qb->join('activity.accompanyingPeriod', 'actacp'); + } $qb->select('SUM(activity.durationTime) as export_sum_activity_duration'); diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php index bc67e7569..212b1384f 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php @@ -83,8 +83,11 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - $qb = $this->repository->createQueryBuilder('activity') - ->join('activity.accompanyingPeriod', 'acp'); + $qb = $this->repository->createQueryBuilder('activity'); + + if (!in_array('actacp', $qb->getAllAliases(), true)) { + $qb->join('activity.accompanyingPeriod', 'actacp'); + } $qb->select('SUM(activity.travelTime) as export_sum_activity_visit_duration'); diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php index 6881528f6..398fb14bb 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php @@ -84,8 +84,11 @@ class CountActivity implements ExportInterface, GroupedExportInterface { $centers = array_map(static fn ($el) => $el['center'], $acl); - $qb = $this->activityRepository->createQueryBuilder('activity') - ->join('activity.person', 'person'); + $qb = $this->activityRepository->createQueryBuilder('activity'); + + if (!in_array('actperson', $qb->getAllAliases(), true)) { + $qb->join('activity.person', 'actperson'); + } $qb->select('COUNT(activity.id) as export_count_activity'); diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php index fd2b36e65..17b9bd687 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php @@ -210,9 +210,9 @@ class ListActivity implements ListInterface, GroupedExportInterface $qb ->from('ChillActivityBundle:Activity', 'activity') - ->join('activity.person', 'person') - ->join('person.center', 'center') - ->andWhere('center IN (:authorized_centers)') + ->join('activity.person', 'actperson') + ->join('actperson.center', 'actcenter') + ->andWhere('actcenter IN (:authorized_centers)') ->setParameter('authorized_centers', $centers); foreach ($this->fields as $f) { @@ -239,8 +239,8 @@ class ListActivity implements ListInterface, GroupedExportInterface break; case 'user_username': - $qb->join('activity.user', 'user'); - $qb->addSelect('user.username AS user_username'); + $qb->join('activity.user', 'actuser'); + $qb->addSelect('actuser.username AS user_username'); break; diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php index eabe5a15b..bcb4da05d 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php @@ -120,9 +120,9 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface } return $qb->select($select) - ->join('activity.person', 'person') - ->join('person.center', 'center') - ->where($qb->expr()->in('center', ':centers')) + ->join('activity.person', 'actperson') + ->join('actperson.center', 'actcenter') + ->where($qb->expr()->in('actcenter', ':centers')) ->setParameter(':centers', $centers); } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php index 7c3508674..5737220b2 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php @@ -39,11 +39,11 @@ class BySocialActionFilter implements FilterInterface { $where = $qb->getDQLPart('where'); - if (!in_array('socialaction', $qb->getAllAliases(), true)) { - $qb->join('activity.socialActions', 'socialaction'); + if (!in_array('actsocialaction', $qb->getAllAliases(), true)) { + $qb->join('activity.socialActions', 'actsocialaction'); } - $clause = $qb->expr()->in('socialaction.id', ':socialactions'); + $clause = $qb->expr()->in('actsocialaction.id', ':socialactions'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php index a1b5ad1ba..1a9fdb519 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php @@ -39,11 +39,11 @@ class BySocialIssueFilter implements FilterInterface { $where = $qb->getDQLPart('where'); - if (!in_array('socialissue', $qb->getAllAliases(), true)) { - $qb->join('activity.socialIssues', 'socialissue'); + if (!in_array('actsocialissue', $qb->getAllAliases(), true)) { + $qb->join('activity.socialIssues', 'actsocialissue'); } - $clause = $qb->expr()->in('socialissue.id', ':socialissues'); + $clause = $qb->expr()->in('actsocialissue.id', ':socialissues'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php index 75e9dfa16..19ddee3ca 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php @@ -39,11 +39,11 @@ class ByUserFilter implements FilterInterface { $where = $qb->getDQLPart('where'); - if (!in_array('user', $qb->getAllAliases(), true)) { - $qb->join('activity.users', 'user'); + if (!in_array('actusers', $qb->getAllAliases(), true)) { + $qb->join('activity.users', 'actusers'); } - $clause = $qb->expr()->in('user.id', ':users'); + $clause = $qb->expr()->in('actusers.id', ':users'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php index def2ac84d..4ab27f043 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php @@ -37,12 +37,12 @@ class LocationTypeFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('location', $qb->getAllAliases(), true)) { - $qb->join('activity.location', 'location'); + if (!in_array('actloc', $qb->getAllAliases(), true)) { + $qb->join('activity.location', 'actloc'); } $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('location.locationType', ':locationtype'); + $clause = $qb->expr()->in('actloc.locationType', ':locationtype'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php index ba0f8cb75..c0cda26a4 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php @@ -37,13 +37,13 @@ class UserScopeFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - if (!in_array('user', $qb->getAllAliases(), true)) { - $qb->join('activity.user', 'user'); + if (!in_array('actuser', $qb->getAllAliases(), true)) { + $qb->join('activity.user', 'actuser'); } $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('user.mainScope', ':userscope'); + $clause = $qb->expr()->in('actuser.mainScope', ':userscope'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php index e6504ba26..77d887fdf 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php @@ -102,23 +102,4 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter ->addViolation(); } } - - /** - * Check if a join between Activity and Reason is already defined. - * - * @param Join[] $joins - * @param mixed $alias - * - * @return bool - */ - private function checkJoinAlreadyDefined(array $joins, $alias) - { - foreach ($joins as $join) { - if ($join->getAlias() === $alias) { - return true; - } - } - - return false; - } } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php index 1ab5ffff4..6d78b3b38 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php @@ -52,20 +52,9 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt $where = $qb->getDQLPart('where'); $join = $qb->getDQLPart('join'); $clause = $qb->expr()->in('reasons', ':selected_activity_reasons'); - //dump($join); - // add a join to reasons only if needed - if ( - ( - array_key_exists('activity', $join) - && !$this->checkJoinAlreadyDefined($join['activity'], 'reasons') - ) - || (!array_key_exists('activity', $join)) - ) { - $qb->add( - 'join', - ['activity' => new Join(Join::INNER_JOIN, 'activity.reasons', 'reasons')], - true - ); + + if (!in_array('actreasons', $qb->getAllAliases(), true)) { + $qb->join('activity.reasons', 'actreasons'); } if ($where instanceof Expr\Andx) { @@ -123,21 +112,4 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt ->addViolation(); } } - - /** - * Check if a join between Activity and Reason is already defined. - * - * @param Join[] $joins - * @param mixed $alias - */ - private function checkJoinAlreadyDefined(array $joins, $alias): bool - { - foreach ($joins as $join) { - if ($join->getAlias() === $alias) { - return true; - } - } - - return false; - } } diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php index e0a024f45..57ec33cdd 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php @@ -40,9 +40,11 @@ final class AgentAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('cal.user', 'u'); + if (!in_array('caluser', $qb->getAllAliases(), true)) { + $qb->join('cal.user', 'caluser'); + } - $qb->addSelect('u.id AS agent_aggregator'); + $qb->addSelect('caluser.id AS agent_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php index 76b2cb133..a07f052bf 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php @@ -41,7 +41,9 @@ class CancelReasonAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { // TODO: still needs to take into account appointments without a cancel reason somehow - $qb->join('cal.cancelReason', 'cr'); + if (!in_array('calcancel', $qb->getAllAliases(), true)) { + $qb->join('cal.cancelReason', 'calcancel'); + } $qb->addSelect('IDENTITY(cal.cancelReason) as cancel_reason_aggregator'); diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php index 0e9352198..17905cf35 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php @@ -40,9 +40,11 @@ final class JobAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('cal.user', 'u'); + if (!in_array('caluser', $qb->getAllAliases(), true)) { + $qb->join('cal.user', 'caluser'); + } - $qb->addSelect('IDENTITY(u.userJob) as job_aggregator'); + $qb->addSelect('IDENTITY(caluser.userJob) as job_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php index cd7e88a1e..236b1b74f 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php @@ -36,7 +36,9 @@ final class LocationAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('cal.location', 'l'); + if (!in_array('calloc', $qb->getAllAliases(), true)) { + $qb->join('cal.location', 'calloc'); + } $qb->addSelect('IDENTITY(cal.location) as location_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php index dea8eecb4..c8d02160f 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php @@ -40,9 +40,11 @@ final class LocationTypeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('cal.location', 'l'); + if (!in_array('calloc', $qb->getAllAliases(), true)) { + $qb->join('cal.location', 'calloc'); + } - $qb->addSelect('IDENTITY(l.locationType) as location_type_aggregator'); + $qb->addSelect('IDENTITY(calloc.locationType) as location_type_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php index 4ae3fb99c..7605c3d5d 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php @@ -40,9 +40,11 @@ final class ScopeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('cal.user', 'u'); + if (!in_array('caluser', $qb->getAllAliases(), true)) { + $qb->join('cal.user', 'caluser'); + } - $qb->addSelect('IDENTITY(u.mainScope) as scope_aggregator'); + $qb->addSelect('IDENTITY(caluser.mainScope) as scope_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php index cb3b8b2cd..03cd4857d 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php @@ -42,10 +42,12 @@ class JobFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('cal.user', 'u'); + if (!in_array('caluser', $qb->getAllAliases(), true)) { + $qb->join('cal.user', 'caluser'); + } $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('u.userJob', ':job'); + $clause = $qb->expr()->in('caluser.userJob', ':job'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php index 55699d79a..cbd566e9e 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php @@ -42,10 +42,12 @@ class ScopeFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('cal.user', 'u'); + if (!in_array('caluser', $qb->getAllAliases(), true)) { + $qb->join('cal.user', 'caluser'); + } $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('u.mainScope', ':scope'); + $clause = $qb->expr()->in('caluser.mainScope', ':scope'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php index b63d3842f..c0b52053d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php @@ -48,12 +48,12 @@ final class HouseholdPositionAggregator implements AggregatorInterface, ExportEl $qb->resetDQLPart('from'); $qb->from(HouseholdMember::class, 'member'); - if (!in_array('person', $qb->getAllAliases(), true)) { - $qb->join('member.person', 'person'); + if (!in_array('memberperson', $qb->getAllAliases(), true)) { + $qb->join('member.person', 'memberperson'); } - if (!in_array('center', $qb->getAllAliases(), true)) { - $qb->join('person.center', 'center'); + if (!in_array('membercenter', $qb->getAllAliases(), true)) { + $qb->join('memberperson.center', 'membercenter'); } $qb->andWhere($qb->expr()->andX( diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php index 5e39c6310..e799d8dfa 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php @@ -37,8 +37,11 @@ final class MaritalStatusAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('person.maritalStatus', 'ms'); - $qb->addSelect('ms.id as marital_status_aggregator'); + if (!in_array('personmarital', $qb->getAllAliases(), true)) { + $qb->join('person.maritalStatus', 'personmarital'); + } + + $qb->addSelect('personmarital.id as marital_status_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php index d0da45560..b76db495d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php @@ -38,8 +38,11 @@ final class ActionTypeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acpw.socialAction', 'sa'); - $qb->addSelect('sa.id as action_type_aggregator'); + if (!in_array('acpwsocialaction', $qb->getAllAliases(), true)) { + $qb->join('acpw.socialAction', 'acpwsocialaction'); + } + + $qb->addSelect('acpwsocialaction.id as action_type_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php index d1f33ca7a..4310dcac2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php @@ -37,8 +37,11 @@ final class GoalAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acpw.goals', 'g'); - $qb->addSelect('g.id as goal_aggregator'); + if (!in_array('goal', $qb->getAllAliases(), true)) { + $qb->join('acpw.goals', 'goal'); + } + + $qb->addSelect('goal.id as goal_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php index 10c588809..4d27aa873 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php @@ -39,9 +39,11 @@ final class JobAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acpw.referrers', 'u'); + if (!in_array('acpwuser', $qb->getAllAliases(), true)) { + $qb->join('acpw.referrers', 'acpwuser'); + } - $qb->addSelect('IDENTITY(u.userJob) as job_aggregator'); + $qb->addSelect('IDENTITY(acpwuser.userJob) as job_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php index efda6b783..35e1e218d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php @@ -39,9 +39,11 @@ final class ReferrerAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acpw.referrers', 'u'); + if (!in_array('acpwuser', $qb->getAllAliases(), true)) { + $qb->join('acpw.referrers', 'acpwuser'); + } - $qb->addSelect('u.id AS referrer_aggregator'); + $qb->addSelect('acpwuser.id AS referrer_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php index 9bdcebb60..47391ed69 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php @@ -37,10 +37,19 @@ final class ResultAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acpw.results', 'res'); - $qb->join('acpw.goals', 'g'); - $qb->join('g.results', 'gres'); - $qb->addSelect('res.id, IDENTITY(g.results) as result_aggregator'); + if (!in_array('acpwresult', $qb->getAllAliases(), true)) { + $qb->join('acpw.results', 'acpwresult'); + } + + if (!in_array('goal', $qb->getAllAliases(), true)) { + $qb->join('acpw.goals', 'goal'); + } + + if (!in_array('goalresult', $qb->getAllAliases(), true)) { + $qb->join('goal.results', 'goalresult'); + } + + $qb->addSelect('acpwresult.id, IDENTITY(goal.results) as result_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php index ee2509977..ee479d503 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php @@ -39,9 +39,11 @@ final class ScopeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acpw.referrers', 'u'); + if (!in_array('acpwuser', $qb->getAllAliases(), true)) { + $qb->join('acpw.referrers', 'acpwuser'); + } - $qb->addSelect('IDENTITY(u.mainScope) as scope_aggregator'); + $qb->addSelect('IDENTITY(acpwuser.mainScope) as scope_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php index 2659172a4..f76a00c33 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php @@ -45,12 +45,16 @@ class ActivityTypeFilter implements FilterInterface $qb->resetDQLPart('from'); $qb->from('ChillActivityBundle:Activity', 'activity'); - $qb - ->join('activity.accompanyingPeriod', 'acp') - ->join('activity.activityType', 'aty'); + if (!in_array('actacp', $qb->getAllAliases(), true)) { + $qb->join('activity.accompanyingPeriod', 'actacp'); + } + + if (!in_array('acttype', $qb->getAllAliases(), true)) { + $qb->join('activity.activityType', 'acttype'); + } $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('aty.id', ':activitytypes'); + $clause = $qb->expr()->in('acttype.id', ':activitytypes'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php index c0eb98513..0664f2a8d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php @@ -47,12 +47,12 @@ class SocialActionFilter implements FilterInterface $qb->join('acp.works', 'acpw'); } - if (!in_array('acpw', $qb->getAllAliases(), true)) { - $qb->join('acpw.socialAction', 'sa'); + if (!in_array('acpwsocialaction', $qb->getAllAliases(), true)) { + $qb->join('acpw.socialAction', 'acpwsocialaction'); } $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('sa.id', ':socialactions'); + $clause = $qb->expr()->in('acpwsocialaction.id', ':socialactions'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php index 860598927..73c551286 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php @@ -39,18 +39,29 @@ class ResidentialAddressAtThirdpartyFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { $qb->resetDQLPart('from'); - $qb->from('ChillPersonBundle:Person\ResidentialAddress', 'ra'); + $qb->from('ChillPersonBundle:Person\ResidentialAddress', 'resaddr'); - $qb->join('ra.person', 'person'); - $qb->join('person.center', 'center'); - $qb->join('ra.hostThirdParty', 't'); - $qb->join('t.categories', 'tc'); + if (!in_array('resaddrperson', $qb->getAllAliases(), true)) { + $qb->join('resaddr.person', 'resaddrperson'); + } + + if (!in_array('resaddrcenter', $qb->getAllAliases(), true)) { + $qb->join('resaddrperson.center', 'resaddrcenter'); + } + + if (!in_array('tparty', $qb->getAllAliases(), true)) { + $qb->join('resaddr.hostThirdParty', 'tparty'); + } + + if (!in_array('tpartycat', $qb->getAllAliases(), true)) { + $qb->join('tparty.categories', 'tpartycat'); + } $where = $qb->getDQLPart('where'); $clause = $qb->expr()->andX( - $qb->expr()->isNotNull('ra.hostThirdParty'), - $qb->expr()->between(':date', 'ra.startDate', 'ra.endDate'), - $qb->expr()->in('tc.id', ':type') + $qb->expr()->isNotNull('resaddr.hostThirdParty'), + $qb->expr()->between(':date', 'resaddr.startDate', 'resaddr.endDate'), + $qb->expr()->in('tpartycat.id', ':type') ); if ($where instanceof Expr\Andx) { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php index 5fd2a718b..5e78e574e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php @@ -26,13 +26,18 @@ class ResidentialAddressAtUserFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { $qb->resetDQLPart('from'); - $qb->from('ChillPersonBundle:Person\ResidentialAddress', 'ra'); + $qb->from('ChillPersonBundle:Person\ResidentialAddress', 'resaddr'); - $qb->join('ra.person', 'person'); - $qb->join('person.center', 'center'); + if (!in_array('resaddrperson', $qb->getAllAliases(), true)) { + $qb->join('resaddr.person', 'resaddrperson'); + } + + if (!in_array('resaddrcenter', $qb->getAllAliases(), true)) { + $qb->join('resaddrperson.center', 'resaddrcenter'); + } $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->isNotNull('ra.hostPerson'); + $clause = $qb->expr()->isNotNull('resaddr.hostPerson'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php index 386570c8e..a93dae54d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php @@ -42,10 +42,12 @@ class JobFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acpw.referrers', 'u'); + if (!in_array('acpwuser', $qb->getAllAliases(), true)) { + $qb->join('acpw.referrers', 'acpwuser'); + } $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('u.userJob', ':job'); + $clause = $qb->expr()->in('acpwuser.userJob', ':job'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php index f3fa7e359..e1ddd70fd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php @@ -36,10 +36,12 @@ class ReferrerFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acpw.referrers', 'u'); + if (!in_array('acpwuser', $qb->getAllAliases(), true)) { + $qb->join('acpw.referrers', 'acpwuser'); + } $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('u', ':agents'); + $clause = $qb->expr()->in('acpwuser', ':agents'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php index d707edf7f..ae525a4e5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php @@ -42,10 +42,12 @@ class ScopeFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acpw.referrers', 'u'); + if (!in_array('acpwuser', $qb->getAllAliases(), true)) { + $qb->join('acpw.referrers', 'acpwuser'); + } $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('u.mainScope', ':scope'); + $clause = $qb->expr()->in('acpwuser.mainScope', ':scope'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterTest.php index a332c89dc..8d2c8ef5b 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AccompanyingCourseFilters/ReferrerFilterTest.php @@ -79,8 +79,8 @@ final class ReferrerFilterTest extends AbstractFilterTest ->select('acpw.id'), $em->createQueryBuilder() ->from('ChillPersonBundle:AccompanyingPeriod\AccompanyingPeriodWork', 'acpw') - ->join('acpw.referrers', 'r') - ->select('r.id'), + ->join('acpw.referrers', 'acpwuser') + ->select('acpwuser.id'), ]; } }