diff --git a/.changes/v2.12.0.md b/.changes/v2.12.0.md new file mode 100644 index 000000000..e4e02efa0 --- /dev/null +++ b/.changes/v2.12.0.md @@ -0,0 +1,26 @@ +## v2.12.0 - 2023-11-15 +### Feature +* ([#199](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/199)) Export: add an aggregator "group activities by presence" +* ([#199](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/199)) Export: add a filter "filter activity by activity presence" +* ([#199](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/199)) Export: add an aggregator "group activities by person" (only for the activities saved in a person context) +* ([#199](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/199)) Export: add a new aggregator "group peoples by postal code" +* ([#200](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/200)) Export: split export about person on accompanying period work: one with the people associated with the work, another one with the people associated with the accompanying period +* ([#204](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/204)) Add 3 new filters and 3 new aggregators for work action creator (with jobs and scopes) + +* ([#202](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/202)) Create export for the average duration of social work actions +* ([#206](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/206)) Export: add a export which count persons on accompanying period work +* ([#206](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/206)) Export: add an export which count persons on activity +* ([#203](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/203)) Export: add clauses on the social work start date and end date within the filter "Filter accompanying period by accompanying period work" +### Fixed +* Export: fix typo in filter "filter accompanying period work on end date" +* ([#189](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/189)) Export: Fix failure in export linked to household +* ([#205](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/205)) Fix loading of accompanying period work referrers +### Traduction francophone des principaux changements +* export: ajout d'un regroupement "grouper les échanges par présence de l'usager"; +* export: ajout d'un filtre "filtre les échanges par présence de l'usager"; +* export: ajout d'un regroupement "regrouper les échanges par personne" (seulement pour les échanges enregistrés dans le contexte de l'usager); +* export: ajout d'un regroupement "grouper les usagers par codes postaux" +* export: séparation des exports sur les actions: dans l'un, les filtres des usagers portent sur les usagers concernés par l'action, dans l'autre, les filtres portent sur les usagers concernés par le parcours de l'action; +* export: ajout de 3 nouveaux filtres et regroupements sur le créateur de l'action, son métier et son service; +* export: correction de l'export sur les ménages liés aux parcours; +* correction du chargement des actions d'accompagnement diff --git a/.changes/v2.12.1.md b/.changes/v2.12.1.md new file mode 100644 index 000000000..50788fb94 --- /dev/null +++ b/.changes/v2.12.1.md @@ -0,0 +1,3 @@ +## v2.12.1 - 2023-11-16 +### Fixed +* ([#208](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/208)) Export: fix loading of form for "filter action by type, goal and result" diff --git a/.changes/v2.13.0.md b/.changes/v2.13.0.md new file mode 100644 index 000000000..cf6820115 --- /dev/null +++ b/.changes/v2.13.0.md @@ -0,0 +1,9 @@ +## v2.13.0 - 2023-11-21 +### Feature +* ([#173](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/173)) Allow user to add a phonenumber to their profile which will be included in automatically generated documents +### Fixed +* ([#211](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/211)) Export: fix loading of "Group activity by type" +* ([#190](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/190)) Export: fix loading of "group activity by reasons" +* ([#213](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/213)) Export: fix usage of some Collection returned instead of array in export filters +* ([#215](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/215)) Use only the string 'both' for gender (with a database migration) +* ([#212](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/212)) Clean the database to make working the "Group people by gender" aggregator diff --git a/.changes/v2.14.0.md b/.changes/v2.14.0.md new file mode 100644 index 000000000..560372fff --- /dev/null +++ b/.changes/v2.14.0.md @@ -0,0 +1,8 @@ +## v2.14.0 - 2023-11-24 +### Feature +* ([#161](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/161)) Export: in filter "Filter accompanying period work (social action) by type, goal and result", order the items alphabetically or with the defined order +### Fixed +* ([#141](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/141)) Export: on filter "action by type goals, and results", restore the fields when editing a saved export +* ([#219](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/219)) Export: fix the list of accompanying period work, when the "calc date" is null +* ([#222](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/222)) Fix rendering of custom fields +* Fix various errors in custom fields administration diff --git a/.changes/v2.14.1.md b/.changes/v2.14.1.md new file mode 100644 index 000000000..4400953fd --- /dev/null +++ b/.changes/v2.14.1.md @@ -0,0 +1,5 @@ +## v2.14.1 - 2023-11-29 +### Fixed +* Export: fix list person with custom fields +* ([#100](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/100)) Add a paginator to budget elements (resource and charge types) in the admin +* Fix error in ListEvaluation when "handling agents" are alone diff --git a/.changes/v2.15.0.md b/.changes/v2.15.0.md new file mode 100644 index 000000000..3c350870b --- /dev/null +++ b/.changes/v2.15.0.md @@ -0,0 +1,11 @@ +## v2.15.0 - 2023-12-11 +### Feature +* ([#191](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/191)) Add export "number of household associate with an exchange" +* ([#235](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/235)) Export: add dates on the filter "filter course by activity type" +### Fixed +* ([#214](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/214)) Fix error when posting an empty comment on an accompanying period. +* ([#233](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/233)) Fix "filter evaluation by evaluation type" (and add select2 to the list of evaluation types to pick) +* ([#234](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/234)) Fix "filter aside activity by date" + +* ([#228](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/228)) Fix export of activity for people created before the introduction of the createdAt column on person (during v1) +* ([#246](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/246)) Do not show activities, evaluations and social work when associated to a confidential accompanying period, except for the users which are allowed to see them diff --git a/.changes/v2.15.1.md b/.changes/v2.15.1.md new file mode 100644 index 000000000..aa510541d --- /dev/null +++ b/.changes/v2.15.1.md @@ -0,0 +1,5 @@ +## v2.15.1 - 2023-12-20 +### Fixed +* Fix the household export query to exclude accompanying periods that are in draft state. +### DX +* ([#167](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/167)) Fixed readthedocs compilation by updating readthedocs config file and requirements for Sphinx diff --git a/.changes/v2.15.2.md b/.changes/v2.15.2.md new file mode 100644 index 000000000..739b2482b --- /dev/null +++ b/.changes/v2.15.2.md @@ -0,0 +1,5 @@ +## v2.15.2 - 2024-01-11 +### Fixed +* Fix the id_seq used when creating a new accompanying period participation during fusion of two person files +### DX +* Set placeholder to False for expanded EntityType form fields where required is set to False. diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 32b7e5221..e976a4d18 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,10 @@ cache: services: - name: postgis/postgis:14-3.3-alpine alias: db + command: + - postgres + - "-c" + - max_connections=1000 - name: redis alias: redis @@ -47,7 +51,7 @@ build: paths: - .cache/ artifacts: - expire_in: 30 min + expire_in: 1 day paths: - bin - vendor/ @@ -61,7 +65,7 @@ code_style: paths: - .cache/ artifacts: - expire_in: 30 min + expire_in: 1 day paths: - bin - vendor/ @@ -75,7 +79,7 @@ phpstan_tests: paths: - .cache/ artifacts: - expire_in: 30 min + expire_in: 1 day paths: - bin - vendor/ @@ -90,7 +94,7 @@ rector_tests: paths: - .cache/ artifacts: - expire_in: 30 min + expire_in: 1 day paths: - bin - vendor/ @@ -117,7 +121,7 @@ unit_tests: - php -d memory_limit=3G tests/console doctrine:fixtures:load -n - php -d memory_limit=4G bin/phpunit --colors=never --exclude-group dbIntensive artifacts: - expire_in: 30 min + expire_in: 1 day paths: - bin - vendor/ diff --git a/.readthedocs.yml b/.readthedocs.yml index 3b5a7def9..cd8f36eba 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,10 +1,14 @@ --- version: 2 +build: + os: ubuntu-22.04 + tools: + python: "3.7" + sphinx: configuration: docs/source/conf.py python: - version: 3.7 install: - - requirements: docs/requirements.txt + - requirements: docs/requirements.txt \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 99a16fea2..4a731bae4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,86 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## v2.15.2 - 2024-01-11 +### Fixed +* Fix the id_seq used when creating a new accompanying period participation during fusion of two person files +### DX +* Set placeholder to False for expanded EntityType form fields where required is set to False. + +## v2.15.1 - 2023-12-20 +### Fixed +* Fix the household export query to exclude accompanying periods that are in draft state. +### DX +* ([#167](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/167)) Fixed readthedocs compilation by updating readthedocs config file and requirements for Sphinx + +## v2.15.0 - 2023-12-11 +### Feature +* ([#191](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/191)) Add export "number of household associate with an exchange" +* ([#235](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/235)) Export: add dates on the filter "filter course by activity type" +### Fixed +* ([#214](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/214)) Fix error when posting an empty comment on an accompanying period. +* ([#233](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/233)) Fix "filter evaluation by evaluation type" (and add select2 to the list of evaluation types to pick) +* ([#234](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/234)) Fix "filter aside activity by date" + +* ([#228](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/228)) Fix export of activity for people created before the introduction of the createdAt column on person (during v1) +* ([#246](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/246)) Do not show activities, evaluations and social work when associated to a confidential accompanying period, except for the users which are allowed to see them + +## v2.14.1 - 2023-11-29 +### Fixed +* Export: fix list person with custom fields +* ([#100](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/100)) Add a paginator to budget elements (resource and charge types) in the admin +* Fix error in ListEvaluation when "handling agents" are alone + +## v2.14.0 - 2023-11-24 +### Feature +* ([#161](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/161)) Export: in filter "Filter accompanying period work (social action) by type, goal and result", order the items alphabetically or with the defined order +### Fixed +* ([#141](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/141)) Export: on filter "action by type goals, and results", restore the fields when editing a saved export +* ([#219](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/219)) Export: fix the list of accompanying period work, when the "calc date" is null +* ([#222](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/222)) Fix rendering of custom fields +* Fix various errors in custom fields administration + +## v2.13.0 - 2023-11-21 +### Feature +* ([#173](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/173)) Allow user to add a phonenumber to their profile which will be included in automatically generated documents +### Fixed +* ([#211](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/211)) Export: fix loading of "Group activity by type" +* ([#190](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/190)) Export: fix loading of "group activity by reasons" +* ([#213](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/213)) Export: fix usage of some Collection returned instead of array in export filters +* ([#215](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/215)) Use only the string 'both' for gender (with a database migration) +* ([#212](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/212)) Clean the database to make working the "Group people by gender" aggregator + +## v2.12.1 - 2023-11-16 +### Fixed +* ([#208](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/208)) Export: fix loading of form for "filter action by type, goal and result" + +## v2.12.0 - 2023-11-15 +### Feature +* ([#199](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/199)) Export: add an aggregator "group activities by presence" +* ([#199](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/199)) Export: add a filter "filter activity by activity presence" +* ([#199](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/199)) Export: add an aggregator "group activities by person" (only for the activities saved in a person context) +* ([#199](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/199)) Export: add a new aggregator "group peoples by postal code" +* ([#200](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/200)) Export: split export about person on accompanying period work: one with the people associated with the work, another one with the people associated with the accompanying period +* ([#204](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/204)) Add 3 new filters and 3 new aggregators for work action creator (with jobs and scopes) + +* ([#202](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/202)) Create export for the average duration of social work actions +* ([#206](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/206)) Export: add a export which count persons on accompanying period work +* ([#206](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/206)) Export: add an export which count persons on activity +* ([#203](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/203)) Export: add clauses on the social work start date and end date within the filter "Filter accompanying period by accompanying period work" +### Fixed +* Export: fix typo in filter "filter accompanying period work on end date" +* ([#189](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/189)) Export: Fix failure in export linked to household +* ([#205](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/205)) Fix loading of accompanying period work referrers +### Traduction francophone des principaux changements +* export: ajout d'un regroupement "grouper les échanges par présence de l'usager"; +* export: ajout d'un filtre "filtre les échanges par présence de l'usager"; +* export: ajout d'un regroupement "regrouper les échanges par personne" (seulement pour les échanges enregistrés dans le contexte de l'usager); +* export: ajout d'un regroupement "grouper les usagers par codes postaux" +* export: séparation des exports sur les actions: dans l'un, les filtres des usagers portent sur les usagers concernés par l'action, dans l'autre, les filtres portent sur les usagers concernés par le parcours de l'action; +* export: ajout de 3 nouveaux filtres et regroupements sur le créateur de l'action, son métier et son service; +* export: correction de l'export sur les ménages liés aux parcours; +* correction du chargement des actions d'accompagnement + ## v2.11.0 - 2023-11-07 ### Feature * ([#194](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/194)) Export: add a filter "filter activity by creator job" diff --git a/docs/README.md b/docs/README.md index 98b199f02..8ae7f650a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -27,7 +27,7 @@ To compile this documentation : Contribute =========== -Issue tracker : https://git.framasoft.org/groups/Chill-project/issues +Issue tracker : https://gitlab.com/Chill-Projet/chill-bundles/-/issues Licence ======= diff --git a/docs/requirements.txt b/docs/requirements.txt index 26a019bfa..a8d979a2b 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,6 +1,7 @@ docutils==0.13.1 Pygments==2.2.0 sphinx==1.8.5 +Jinja2<3.1 git+https://github.com/fabpot/sphinx-php.git@v2.0.2#egg_name=sphinx-php jsx-lexer===0.0.8 sphinx_rtd_theme==0.5.0 diff --git a/docs/source/installation/index.rst b/docs/source/installation/index.rst index 910122196..9e6f2ed87 100644 --- a/docs/source/installation/index.rst +++ b/docs/source/installation/index.rst @@ -49,7 +49,7 @@ Clone or download the chill-skeleton project and `cd` into the main directory. .. code-block:: bash git clone https://gitlab.com/Chill-Projet/chill-skeleton-basic.git - cd chill-app + cd chill-skeleton-basic As a developer, the code will stay on your computer and will be executed in docker container. To avoid permission problem, the code should be run with the same uid/gid from your current user. This is why we get your current user id with the command ``id -u`` in each following scripts. diff --git a/docs/source/installation/msgraph-configure.rst b/docs/source/installation/msgraph-configure.rst index 2a0a17882..5655e9ff2 100644 --- a/docs/source/installation/msgraph-configure.rst +++ b/docs/source/installation/msgraph-configure.rst @@ -1,13 +1,15 @@ -Configure Chill for calendar sync and SSO with Microsoft Graph (Outlook) -======================================================================== +Configure Chill for calendar and absence synchronisation and SSO with Microsoft Graph (Outlook) +=============================================================================================== Chill offers the possibility to: * authenticate users using Microsoft Graph, with relatively small adaptations; * synchronize calendar in both ways (`see the user manual for a large description of the feature `_). -Both can be configured separately (synchronising calendars without SSO, or SSO without calendar). When calendar sync is configured without SSL, the user's email address is the key to associate Chill's users with Microsoft's ones. +Both can be configured separately (synchronising calendars without SSO, or SSO without calendar). + +Please note that the user's email address is the key to associate Chill's users with Microsoft's ones. Configure SSO ------------- @@ -46,7 +48,7 @@ Do not forget to provider user's accesses to your app, using the "Utilisateurs e You must know have gathered all the required variables for SSO: -.. code-block:: +.. code-block:: SAML_BASE_URL=https://test.chill.be # must be SAML_ENTITY_ID=https://test.chill.be # must match the one entered @@ -186,20 +188,27 @@ Configure chill app -Configure sync --------------- +Configure sync and calendar access +---------------------------------- -The sync processe might be configured in the same app, or into a different app. +The purpose of this configuration is the following: -The synchronization processes use Oauth2.0 for authentication and authorization. +- let user read their calendar and shared calendar within Chill (with the same permissions as the one configured in Outlook / Azure); +- allow chill instance to write appointment ("Rendez-vous") into their calendar, and invite other users to their appointment; +- allow chill instance to be notified if an appoint is added or removed by the user within another interface than Chill: if the appointment match another one created in the Chill interface, the date and time are updated in Chill; +- allow chill instance to read the absence of the user and, if set, mark the user as absent in Chill; + +The sync processe might be configured in the same app, or into a different app on the Azure side. + +The synchronization processes use Oauth 2.0 / OpenID Connect for authentication and authorization. .. note:: Two flows are in use: - * we authenticate "on behalf of a user", to allow users to see their own calendar or other user's calendar into the web interface. + * we authenticate "on behalf of a user", to allow users to see their own calendar or other user's calendar into the web interface. - Typically, when the page is loaded, Chill first check that an authorization token exists. If not, the user is redirected to Microsoft Azure for authentification and a new token is grabbed (most of the times, this is transparent for users). + Typically, when the page is loaded, Chill first check that an authorization token exists. If not, the user is redirected to Microsoft Azure for authentification and a new token is grabbed (most of the times, this is transparent for users). * Chill also acts "as a machine", to synchronize calendars with a daemon background. @@ -229,8 +238,9 @@ Some explanation: The sync daemon must have write access: * the daemon must be allowed to read all users and their profile, to establish a link between them and the Chill's users: (:code:`Users.Read.All`); -* it must also be allowed to read and write into the calendars (:code:`Calendars.ReadWrite.All`) -* for sending invitation to other users, the permission (:code:`Mail.Send`) must be granted. +* it must also be allowed to read and write into the calendars (:code:`Calendars.ReadWrite.All`); +* for sending invitation to other users, the permission (:code:`Mail.Send`) must be granted; +* and, for reading the absence status of the user and sync it with chill, it must be able to read the mailboxSettings (:code:`MailboxSettings.Read`). At this step, you might choose to accept those permissions for all users, or let them do it by yourself. @@ -301,7 +311,7 @@ The calendar synchronization is processed using symfony messenger. It seems to b The association between chill's users and Microsoft's users is done by this cli command: -.. code-block:: +.. code-block:: bin/console chill:calendar:msgraph-user-map-subscribe diff --git a/docs/source/installation/oauth_api_autorisees.png b/docs/source/installation/oauth_api_autorisees.png index 41222f971..ef4136b10 100644 Binary files a/docs/source/installation/oauth_api_autorisees.png and b/docs/source/installation/oauth_api_autorisees.png differ diff --git a/src/Bundle/ChillActivityBundle/CHANGELOG.md b/src/Bundle/ChillActivityBundle/CHANGELOG.md index 6261aa1db..4cda36f0c 100644 --- a/src/Bundle/ChillActivityBundle/CHANGELOG.md +++ b/src/Bundle/ChillActivityBundle/CHANGELOG.md @@ -28,3 +28,4 @@ Version 1.5.5 - [activity] replace dropdown for selecting reasons and use chillEntity for reason rendering - fix bug: error when trying to edit activity of which the type has been deactivated + diff --git a/src/Bundle/ChillActivityBundle/ChillActivityBundle.php b/src/Bundle/ChillActivityBundle/ChillActivityBundle.php index a85ddbb75..5f872a7dc 100644 --- a/src/Bundle/ChillActivityBundle/ChillActivityBundle.php +++ b/src/Bundle/ChillActivityBundle/ChillActivityBundle.php @@ -13,4 +13,6 @@ namespace Chill\ActivityBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; -class ChillActivityBundle extends Bundle {} +class ChillActivityBundle extends Bundle +{ +} diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 06489010c..153b87f44 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -67,7 +67,8 @@ final class ActivityController extends AbstractController private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly PaginatorFactory $paginatorFactory, - ) {} + ) { + } /** * Deletes a Activity entity. @@ -673,8 +674,8 @@ final class ActivityController extends AbstractController throw $this->createNotFoundException('Accompanying Period not found'); } - // TODO Add permission - // $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person); + // TODO Add permission + // $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person); } else { throw $this->createNotFoundException('Person or Accompanying Period not found'); } diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php index 6d0b825cc..ce9dc64b3 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php @@ -56,7 +56,7 @@ class ActivityReasonCategoryController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReasonCategory::class)->find($id); + $entity = $em->getRepository(ActivityReasonCategory::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.'); @@ -79,7 +79,7 @@ class ActivityReasonCategoryController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entities = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReasonCategory::class)->findAll(); + $entities = $em->getRepository(ActivityReasonCategory::class)->findAll(); return $this->render('@ChillActivity/ActivityReasonCategory/index.html.twig', [ 'entities' => $entities, @@ -111,7 +111,7 @@ class ActivityReasonCategoryController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReasonCategory::class)->find($id); + $entity = $em->getRepository(ActivityReasonCategory::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.'); @@ -131,7 +131,7 @@ class ActivityReasonCategoryController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReasonCategory::class)->find($id); + $entity = $em->getRepository(ActivityReasonCategory::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.'); diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php index 141398cc4..323b27d25 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php @@ -24,7 +24,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; */ class ActivityReasonController extends AbstractController { - public function __construct(private readonly ActivityReasonRepository $activityReasonRepository) {} + public function __construct(private readonly ActivityReasonRepository $activityReasonRepository) + { + } /** * Creates a new ActivityReason entity. @@ -60,7 +62,7 @@ class ActivityReasonController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReason::class)->find($id); + $entity = $em->getRepository(ActivityReason::class)->find($id); if (null === $entity) { throw new NotFoundHttpException('Unable to find ActivityReason entity.'); @@ -115,7 +117,7 @@ class ActivityReasonController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReason::class)->find($id); + $entity = $em->getRepository(ActivityReason::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find ActivityReason entity.'); @@ -135,7 +137,7 @@ class ActivityReasonController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityReason::class)->find($id); + $entity = $em->getRepository(ActivityReason::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find ActivityReason entity.'); diff --git a/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php b/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php index 31fac3be8..fd9899c0b 100644 --- a/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php +++ b/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php @@ -19,7 +19,9 @@ use Doctrine\ORM\EntityManagerInterface; class ActivityEntityListener { - public function __construct(private readonly EntityManagerInterface $em, private readonly AccompanyingPeriodWorkRepository $workRepository) {} + public function __construct(private readonly EntityManagerInterface $em, private readonly AccompanyingPeriodWorkRepository $workRepository) + { + } public function persistActionToCourse(Activity $activity) { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByActivityTypeAggregator.php index cdb66bb77..d8551c11d 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByActivityTypeAggregator.php @@ -31,7 +31,8 @@ final readonly class ByActivityTypeAggregator implements AggregatorInterface private RollingDateConverterInterface $rollingDateConverter, private ActivityTypeRepositoryInterface $activityTypeRepository, private TranslatableStringHelperInterface $translatableStringHelper, - ) {} + ) { + } public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php index 9282f92e4..157f4c023 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; class BySocialActionAggregator implements AggregatorInterface { - public function __construct(private readonly SocialActionRender $actionRender, private readonly SocialActionRepository $actionRepository) {} + public function __construct(private readonly SocialActionRender $actionRender, private readonly SocialActionRepository $actionRepository) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php index bbdadf4d6..94f6506d1 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; class BySocialIssueAggregator implements AggregatorInterface { - public function __construct(private readonly SocialIssueRepository $issueRepository, private readonly SocialIssueRender $issueRender) {} + public function __construct(private readonly SocialIssueRepository $issueRepository, private readonly SocialIssueRender $issueRender) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityPresenceAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityPresenceAggregator.php new file mode 100644 index 000000000..a22a75189 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityPresenceAggregator.php @@ -0,0 +1,76 @@ +activityPresenceRepository->find($value)) { + return ''; + } + + return $this->translatableStringHelper->localize($presence->getName()); + }; + } + + public function getQueryKeys($data) + { + return ['activity_presence_aggregator_attendee']; + } + + public function getTitle(): string + { + return 'export.aggregator.activity.by_activity_presence.Group activity by presence'; + } + + public function addRole(): ?string + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data): void + { + $qb->addSelect('IDENTITY(activity.attendee) AS activity_presence_aggregator_attendee'); + $qb->addGroupBy('activity_presence_aggregator_attendee'); + } + + public function applyOn() + { + return Declarations::ACTIVITY; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php index fa658635b..0cb185857 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php @@ -22,7 +22,9 @@ class ActivityTypeAggregator implements AggregatorInterface { final public const KEY = 'activity_type_aggregator'; - public function __construct(protected ActivityTypeRepositoryInterface $activityTypeRepository, protected TranslatableStringHelperInterface $translatableStringHelper) {} + public function __construct(protected ActivityTypeRepositoryInterface $activityTypeRepository, protected TranslatableStringHelperInterface $translatableStringHelper) + { + } public function addRole(): ?string { @@ -56,20 +58,15 @@ class ActivityTypeAggregator implements AggregatorInterface public function getLabels($key, array $values, $data): \Closure { - // for performance reason, we load data from db only once - $this->activityTypeRepository->findBy(['id' => $values]); - - return function ($value): string { + return function (null|int|string $value): string { if ('_header' === $value) { return 'Activity type'; } - if (null === $value || '' === $value) { + if (null === $value || '' === $value || null === $t = $this->activityTypeRepository->find($value)) { return ''; } - $t = $this->activityTypeRepository->find($value); - return $this->translatableStringHelper->localize($t->getName()); }; } diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php index 61452af22..46b931243 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php @@ -22,7 +22,9 @@ class ActivityUserAggregator implements AggregatorInterface { final public const KEY = 'activity_user_id'; - public function __construct(private readonly UserRepository $userRepository, private readonly UserRender $userRender) {} + public function __construct(private readonly UserRepository $userRepository, private readonly UserRender $userRender) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersAggregator.php index cc4ab9d14..c8ef24332 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; class ActivityUsersAggregator implements AggregatorInterface { - public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly UserRender $userRender) {} + public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly UserRender $userRender) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersJobAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersJobAggregator.php index 3628206ec..591406d59 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersJobAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersJobAggregator.php @@ -27,7 +27,8 @@ class ActivityUsersJobAggregator implements AggregatorInterface public function __construct( private readonly UserJobRepositoryInterface $userJobRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { @@ -65,7 +66,9 @@ class ActivityUsersJobAggregator implements AggregatorInterface return Declarations::ACTIVITY; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersScopeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersScopeAggregator.php index bffce629f..c5d9175b4 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersScopeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersScopeAggregator.php @@ -27,7 +27,8 @@ class ActivityUsersScopeAggregator implements AggregatorInterface public function __construct( private readonly ScopeRepositoryInterface $scopeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { @@ -65,7 +66,9 @@ class ActivityUsersScopeAggregator implements AggregatorInterface return Declarations::ACTIVITY; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ByCreatorAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ByCreatorAggregator.php index 09bdab89e..4e8ec44b0 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ByCreatorAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ByCreatorAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; class ByCreatorAggregator implements AggregatorInterface { - public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly UserRender $userRender) {} + public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly UserRender $userRender) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ByThirdpartyAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ByThirdpartyAggregator.php index 13224bade..15762a4f0 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ByThirdpartyAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ByThirdpartyAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; class ByThirdpartyAggregator implements AggregatorInterface { - public function __construct(private readonly ThirdPartyRepository $thirdPartyRepository, private readonly ThirdPartyRender $thirdPartyRender) {} + public function __construct(private readonly ThirdPartyRepository $thirdPartyRepository, private readonly ThirdPartyRender $thirdPartyRender) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorJobAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorJobAggregator.php index d57670e7f..98960aec6 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorJobAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorJobAggregator.php @@ -27,7 +27,8 @@ class CreatorJobAggregator implements AggregatorInterface public function __construct( private readonly UserJobRepositoryInterface $userJobRepository, private readonly TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { @@ -65,7 +66,9 @@ class CreatorJobAggregator implements AggregatorInterface return Declarations::ACTIVITY; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorScopeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorScopeAggregator.php index 6641f0807..f1fb4b2b6 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorScopeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorScopeAggregator.php @@ -27,7 +27,8 @@ class CreatorScopeAggregator implements AggregatorInterface public function __construct( private readonly ScopeRepository $scopeRepository, private readonly TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { @@ -65,7 +66,9 @@ class CreatorScopeAggregator implements AggregatorInterface return Declarations::ACTIVITY; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/LocationTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/LocationTypeAggregator.php index da2d74f64..69c8a646c 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/LocationTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/LocationTypeAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; class LocationTypeAggregator implements AggregatorInterface { - public function __construct(private readonly LocationTypeRepository $locationTypeRepository, private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly LocationTypeRepository $locationTypeRepository, private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php index 4b1f4894e..569c4ca9a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php @@ -25,7 +25,9 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class ActivityReasonAggregator implements AggregatorInterface, ExportElementValidatedInterface { - public function __construct(protected ActivityReasonCategoryRepository $activityReasonCategoryRepository, protected ActivityReasonRepository $activityReasonRepository, protected TranslatableStringHelper $translatableStringHelper) {} + public function __construct(protected ActivityReasonCategoryRepository $activityReasonCategoryRepository, protected ActivityReasonRepository $activityReasonRepository, protected TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { @@ -99,12 +101,6 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali public function getLabels($key, array $values, $data) { - match ($data['level']) { - 'reasons' => $this->activityReasonRepository->findBy(['id' => $values]), - 'categories' => $this->activityReasonCategoryRepository->findBy(['id' => $values]), - default => throw new \RuntimeException(sprintf("The level data '%s' is invalid.", $data['level'])), - }; - return function ($value) use ($data) { if ('_header' === $value) { return 'reasons' === $data['level'] ? 'Group by reasons' : 'Group by categories of reason'; diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/PersonAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/PersonAggregator.php new file mode 100644 index 000000000..96c330071 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/PersonAggregator.php @@ -0,0 +1,67 @@ +labelPersonHelper->getLabel($key, $values, 'export.aggregator.person.by_person.person'); + } + + public function getQueryKeys($data) + { + return ['activity_by_person_agg']; + } + + public function getTitle() + { + return 'export.aggregator.person.by_person.title'; + } + + public function addRole(): ?string + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb + ->addSelect('IDENTITY(activity.person) AS activity_by_person_agg') + ->addGroupBy('activity_by_person_agg'); + } + + public function applyOn() + { + return Declarations::ACTIVITY_PERSON; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonsAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonsAggregator.php index 8459741c5..18ca489e4 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonsAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonsAggregator.php @@ -25,7 +25,9 @@ final readonly class PersonsAggregator implements AggregatorInterface { private const PREFIX = 'act_persons_agg'; - public function __construct(private LabelPersonHelper $labelPersonHelper) {} + public function __construct(private LabelPersonHelper $labelPersonHelper) + { + } public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/SentReceivedAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/SentReceivedAggregator.php index 774968544..ec436ef61 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/SentReceivedAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/SentReceivedAggregator.php @@ -19,7 +19,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class SentReceivedAggregator implements AggregatorInterface { - public function __construct(private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php index d8b204e8c..96fdfa095 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php @@ -36,7 +36,9 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php index dfd5d966f..6497a232a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php @@ -41,7 +41,9 @@ class CountActivity implements ExportInterface, GroupedExportInterface $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountHouseholdOnActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountHouseholdOnActivity.php new file mode 100644 index 000000000..fc22c8edd --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountHouseholdOnActivity.php @@ -0,0 +1,149 @@ +repository = $em->getRepository(Activity::class); + $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; + } + + public function buildForm(FormBuilderInterface $builder) + { + } + + public function getFormDefaultData(): array + { + return []; + } + + public function getAllowedFormattersTypes(): array + { + return [FormatterInterface::TYPE_TABULAR]; + } + + public function getDescription(): string + { + return 'export.export.count_household_on_activity.description'; + } + + 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) { + throw new \LogicException("the key {$key} is not used by this export"); + } + + return static fn ($value) => '_header' === $value ? 'export.export.count_household_on_activity.header' : $value; + } + + public function getQueryKeys($data): array + { + return ['export_count_activity']; + } + + public function getResult($query, $data) + { + return $query->getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getTitle(): string + { + return 'export.export.count_household_on_activity.title'; + } + + public function getType(): string + { + return Declarations::ACTIVITY; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + $centers = array_map(static fn ($el) => $el['center'], $acl); + + $qb = $this->repository + ->createQueryBuilder('activity') + ->join('activity.persons', 'person') + ->join('activity.accompanyingPeriod', 'acp') + ->join( + HouseholdMember::class, + 'householdmember', + Query\Expr\Join::WITH, + 'person.id = IDENTITY(householdmember.person) AND householdmember.startDate <= activity.date AND (householdmember.endDate IS NULL OR householdmember.endDate > activity.date)' + ) + ->join('householdmember.household', 'household'); + + if ($this->filterStatsByCenters) { + $qb + ->andWhere( + $qb->expr()->exists( + 'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part + JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person) + WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers) + ' + ) + ) + ->setParameter('authorized_centers', $centers); + } + + AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + + $qb->select('COUNT(DISTINCT household.id) as export_count_activity'); + + return $qb; + } + + public function requiredRole(): string + { + return ActivityStatsVoter::STATS; + } + + public function supportsModifiers(): array + { + return [ + Declarations::ACTIVITY, + Declarations::ACTIVITY_ACP, + PersonDeclarations::ACP_TYPE, + PersonDeclarations::PERSON_TYPE, + PersonDeclarations::HOUSEHOLD_TYPE, + ]; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountPersonsOnActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountPersonsOnActivity.php new file mode 100644 index 000000000..26432fc0b --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountPersonsOnActivity.php @@ -0,0 +1,140 @@ +repository = $em->getRepository(Activity::class); + $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; + } + + public function buildForm(FormBuilderInterface $builder) + { + } + + public function getFormDefaultData(): array + { + return []; + } + + public function getAllowedFormattersTypes(): array + { + return [FormatterInterface::TYPE_TABULAR]; + } + + public function getDescription(): string + { + return 'export.export.count_person_on_activity.description'; + } + + 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) { + throw new \LogicException("the key {$key} is not used by this export"); + } + + return static fn ($value) => '_header' === $value ? 'export.export.count_person_on_activity.header' : $value; + } + + public function getQueryKeys($data): array + { + return ['export_count_activity']; + } + + public function getResult($query, $data) + { + return $query->getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getTitle(): string + { + return 'export.export.count_person_on_activity.title'; + } + + public function getType(): string + { + return Declarations::ACTIVITY; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + $centers = array_map(static fn ($el) => $el['center'], $acl); + + $qb = $this->repository + ->createQueryBuilder('activity') + ->join('activity.persons', 'person') + ->join('activity.accompanyingPeriod', 'acp'); + + if ($this->filterStatsByCenters) { + $qb + ->andWhere( + $qb->expr()->exists( + 'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part + JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person) + WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers) + ' + ) + ) + ->setParameter('authorized_centers', $centers); + } + + AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + + $qb->select('COUNT(DISTINCT person.id) as export_count_activity'); + + return $qb; + } + + public function requiredRole(): string + { + return ActivityStatsVoter::STATS; + } + + public function supportsModifiers(): array + { + return [ + Declarations::ACTIVITY, + Declarations::ACTIVITY_ACP, + PersonDeclarations::ACP_TYPE, + PersonDeclarations::PERSON_TYPE, + ]; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php index 270fbd12c..fc9a44889 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php @@ -20,22 +20,18 @@ use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\GroupedExportInterface; use Chill\MainBundle\Export\Helper\TranslatableStringExportLabelHelper; use Chill\MainBundle\Export\ListInterface; -use Chill\PersonBundle\Entity\Person\PersonCenterHistory; +use Chill\PersonBundle\Export\Helper\FilterListAccompanyingPeriodHelperInterface; use Doctrine\ORM\EntityManagerInterface; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Form\FormBuilderInterface; -class ListActivity implements ListInterface, GroupedExportInterface +final readonly class ListActivity implements ListInterface, GroupedExportInterface { - private readonly bool $filterStatsByCenters; - public function __construct( - private readonly ListActivityHelper $helper, - private readonly EntityManagerInterface $entityManager, - private readonly TranslatableStringExportLabelHelper $translatableStringExportLabelHelper, - ParameterBagInterface $parameterBag, + private ListActivityHelper $helper, + private EntityManagerInterface $entityManager, + private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper, + private FilterListAccompanyingPeriodHelperInterface $filterListAccompanyingPeriodHelper, ) { - $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } public function buildForm(FormBuilderInterface $builder) @@ -119,19 +115,7 @@ class ListActivity implements ListInterface, GroupedExportInterface ->leftJoin('acppart.person', 'person') ->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL'); - if ($this->filterStatsByCenters) { - $qb - ->andWhere( - $qb->expr()->exists( - 'SELECT 1 - FROM '.PersonCenterHistory::class.' acl_count_person_history - WHERE acl_count_person_history.person = person - AND acl_count_person_history.center IN (:authorized_centers) - ' - ) - ) - ->setParameter('authorized_centers', $centers); - } + $this->filterListAccompanyingPeriodHelper->addFilterAccompanyingPeriods($qb, $requiredModifiers, $acl, $data); $qb // some grouping are necessary diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php index e0a95b1f5..7614039b0 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php @@ -33,7 +33,9 @@ class CountActivity implements ExportInterface, GroupedExportInterface $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountHouseholdOnActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountHouseholdOnActivity.php new file mode 100644 index 000000000..46466d883 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountHouseholdOnActivity.php @@ -0,0 +1,140 @@ +filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; + } + + public function buildForm(FormBuilderInterface $builder) + { + } + + public function getFormDefaultData(): array + { + return []; + } + + public function getAllowedFormattersTypes() + { + return [FormatterInterface::TYPE_TABULAR]; + } + + public function getDescription() + { + return 'export.export.count_household_on_activity_person.description'; + } + + public function getGroup(): string + { + return 'Exports of activities linked to a person'; + } + + public function getLabels($key, array $values, $data) + { + if ('export_count_activity' !== $key) { + throw new \LogicException("the key {$key} is not used by this export"); + } + + return static fn ($value) => '_header' === $value ? 'export.export.count_household_on_activity_person.header' : $value; + } + + public function getQueryKeys($data) + { + return ['export_count_activity']; + } + + public function getResult($query, $data) + { + return $query->getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getTitle() + { + return 'export.export.count_household_on_activity_person.title'; + } + + public function getType(): string + { + return Declarations::ACTIVITY; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + $centers = array_map(static fn ($el) => $el['center'], $acl); + + $qb = $this->activityRepository + ->createQueryBuilder('activity') + ->join('activity.person', 'person') + ->join( + HouseholdMember::class, + 'householdmember', + Query\Expr\Join::WITH, + 'person = householdmember.person AND householdmember.startDate <= activity.date AND (householdmember.endDate IS NULL OR householdmember.endDate > activity.date)' + ) + ->join('householdmember.household', 'household'); + + $qb->select('COUNT(DISTINCT household.id) as export_count_activity'); + + if ($this->filterStatsByCenters) { + $qb + ->join('person.centerHistory', 'centerHistory') + ->where( + $qb->expr()->andX( + $qb->expr()->lte('centerHistory.startDate', 'activity.date'), + $qb->expr()->orX( + $qb->expr()->isNull('centerHistory.endDate'), + $qb->expr()->gt('centerHistory.endDate', 'activity.date') + ) + ) + ) + ->andWhere($qb->expr()->in('centerHistory.center', ':centers')) + ->setParameter('centers', $centers); + } + + return $qb; + } + + public function requiredRole(): string + { + return ActivityStatsVoter::STATS; + } + + public function supportsModifiers() + { + return [ + Declarations::ACTIVITY, + Declarations::ACTIVITY_PERSON, + PersonDeclarations::PERSON_TYPE, + PersonDeclarations::HOUSEHOLD_TYPE, + ]; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php index 3cdadac67..491d1c094 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php @@ -47,7 +47,9 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php b/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php index 75d2c3fd0..73b49e082 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php @@ -40,7 +40,8 @@ class ListActivityHelper private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatableStringExportLabelHelper $translatableStringLabelHelper, private readonly UserHelper $userHelper - ) {} + ) { + } public function addSelect(QueryBuilder $qb): void { @@ -74,7 +75,9 @@ class ListActivityHelper ->addGroupBy('location.id'); } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getAllowedFormattersTypes() { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php index 31a29c2eb..89fe2e618 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php @@ -15,18 +15,24 @@ use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Entity\ActivityType; use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface; use Chill\MainBundle\Export\FilterInterface; +use Chill\MainBundle\Form\Type\PickRollingDateType; +use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; -class ActivityTypeFilter implements FilterInterface +final readonly class ActivityTypeFilter implements FilterInterface { + private const BASE_EXISTS = 'SELECT 1 FROM '.Activity::class.' act_type_filter_activity WHERE act_type_filter_activity.accompanyingPeriod = acp'; + public function __construct( - private readonly ActivityTypeRepositoryInterface $activityTypeRepository, - private readonly TranslatableStringHelperInterface $translatableStringHelper - ) {} + private ActivityTypeRepositoryInterface $activityTypeRepository, + private TranslatableStringHelperInterface $translatableStringHelper, + private RollingDateConverterInterface $rollingDateConverter, + ) { + } public function addRole(): ?string { @@ -35,13 +41,26 @@ class ActivityTypeFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->andWhere( - $qb->expr()->exists( - 'SELECT 1 FROM '.Activity::class.' act_type_filter_activity - WHERE act_type_filter_activity.activityType IN (:act_type_filter_activity_types) AND act_type_filter_activity.accompanyingPeriod = acp' - ) - ); - $qb->setParameter('act_type_filter_activity_types', $data['accepted_activitytypes']); + $exists = self::BASE_EXISTS; + + if (count($data['accepted_activitytypes']) > 0) { + $exists .= ' AND act_type_filter_activity.activityType IN (:act_type_filter_activity_types)'; + $qb->setParameter('act_type_filter_activity_types', $data['accepted_activitytypes']); + } + + if (null !== $data['date_after']) { + $exists .= ' AND act_type_filter_activity.date >= :act_type_filter_activity_date_after'; + $qb->setParameter('act_type_filter_activity_date_after', $this->rollingDateConverter->convert($data['date_after'])); + } + + if (null !== $data['date_before']) { + $exists .= ' AND act_type_filter_activity.date >= :act_type_filter_activity_date_before'; + $qb->setParameter('act_type_filter_activity_date_before', $this->rollingDateConverter->convert($data['date_before'])); + } + + if (self::BASE_EXISTS !== $exists) { + $qb->andWhere($qb->expr()->exists($exists)); + } } public function applyOn() @@ -60,11 +79,27 @@ class ActivityTypeFilter implements FilterInterface 'multiple' => true, 'expanded' => true, ]); + + $builder->add('date_after', PickRollingDateType::class, [ + 'label' => 'export.filter.activity.acp_by_activity_type.activity after', + 'help' => 'export.filter.activity.acp_by_activity_type.activity after help', + 'required' => false, + ]); + + $builder->add('date_before', PickRollingDateType::class, [ + 'label' => 'export.filter.activity.acp_by_activity_type.activity before', + 'help' => 'export.filter.activity.acp_by_activity_type.activity before help', + 'required' => false, + ]); } public function getFormDefaultData(): array { - return []; + return [ + 'accepted_activitytypes' => [], + 'date_after' => null, + 'date_before' => null, + ]; } public function describeAction($data, $format = 'string'): array @@ -75,8 +110,12 @@ class ActivityTypeFilter implements FilterInterface $types[] = $this->translatableStringHelper->localize($aty->getName()); } - return ['export.filter.activity.acp_by_activity_type.acp_containing_at_least_one_%activitytypes%', [ - '%activitytypes%' => implode(', ', $types), + return ['export.filter.activity.acp_by_activity_type.acp_containing_at_least_one_activitytypes', [ + 'activitytypes' => implode(', ', $types), + 'has_date_after' => null !== $data['date_after'] ? 1 : 0, + 'date_after' => $this->rollingDateConverter->convert($data['date_after']), + 'has_date_before' => null !== $data['date_before'] ? 1 : 0, + 'date_before' => $this->rollingDateConverter->convert($data['date_before']), ]]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php index 13349baa5..3eb4e130e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php @@ -21,7 +21,9 @@ use Symfony\Component\Form\FormBuilderInterface; class BySocialActionFilter implements FilterInterface { - public function __construct(private readonly SocialActionRender $actionRender) {} + public function __construct(private readonly SocialActionRender $actionRender) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php index bef40290e..b482ac156 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php @@ -21,7 +21,9 @@ use Symfony\Component\Form\FormBuilderInterface; class BySocialIssueFilter implements FilterInterface { - public function __construct(private readonly SocialIssueRender $issueRender) {} + public function __construct(private readonly SocialIssueRender $issueRender) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/PeriodHavingActivityBetweenDatesFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/PeriodHavingActivityBetweenDatesFilter.php index 2d3282ad1..77efa9a8b 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/PeriodHavingActivityBetweenDatesFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/PeriodHavingActivityBetweenDatesFilter.php @@ -23,7 +23,8 @@ final readonly class PeriodHavingActivityBetweenDatesFilter implements FilterInt { public function __construct( private RollingDateConverterInterface $rollingDateConverter, - ) {} + ) { + } public function getTitle() { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php index e3d7796d3..93e70076d 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php @@ -23,7 +23,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ActivityDateFilter implements FilterInterface { - public function __construct(protected TranslatorInterface $translator, private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(protected TranslatorInterface $translator, private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityPresenceFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityPresenceFilter.php new file mode 100644 index 000000000..f1f1a668c --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityPresenceFilter.php @@ -0,0 +1,83 @@ +add('presences', EntityType::class, [ + 'class' => ActivityPresence::class, + 'choice_label' => fn (ActivityPresence $presence) => $this->translatableStringHelper->localize($presence->getName()) + .($presence->isActive() ? '' : ' ('.$this->translator->trans('inactive').')'), + 'multiple' => true, + 'expanded' => true, + 'label' => 'export.filter.activity.by_presence.presences', + ]); + } + + public function getFormDefaultData(): array + { + return []; + } + + public function describeAction($data, $format = 'string') + { + $presences = array_map( + fn (ActivityPresence $presence) => $this->translatableStringHelper->localize($presence->getName()), + $data['presences'] instanceof Collection ? $data['presences']->toArray() : $data['presences'] + ); + + return [ + 'export.filter.activity.by_presence.Filtered by activity presence: only %presences%', + ['%presences%' => implode(', ', $presences)], + ]; + } + + public function addRole(): ?string + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb + ->andWhere('activity.attendee IN (:activity_presence_filter_presences)') + ->setParameter('activity_presence_filter_presences', $data['presences']); + } + + public function applyOn() + { + return Declarations::ACTIVITY; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php index ae47146df..b59dfa301 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php @@ -27,7 +27,8 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter public function __construct( protected TranslatableStringHelperInterface $translatableStringHelper, protected ActivityTypeRepositoryInterface $activityTypeRepository - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php index 56285c026..313ee7cbc 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; class ActivityUsersFilter implements FilterInterface { - public function __construct(private readonly UserRender $userRender) {} + public function __construct(private readonly UserRender $userRender) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ByCreatorFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ByCreatorFilter.php index f75c5a817..8cb7db569 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ByCreatorFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ByCreatorFilter.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; class ByCreatorFilter implements FilterInterface { - public function __construct(private readonly UserRender $userRender) {} + public function __construct(private readonly UserRender $userRender) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/CreatorJobFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/CreatorJobFilter.php index 4288920e9..6ce340874 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/CreatorJobFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/CreatorJobFilter.php @@ -32,7 +32,8 @@ final readonly class CreatorJobFilter implements FilterInterface private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator, private UserJobRepositoryInterface $userJobRepository, - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/CreatorScopeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/CreatorScopeFilter.php index e5da96554..a6ab07ade 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/CreatorScopeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/CreatorScopeFilter.php @@ -27,7 +27,8 @@ class CreatorScopeFilter implements FilterInterface public function __construct( private readonly TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/EmergencyFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/EmergencyFilter.php index b74be2552..eca62b79e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/EmergencyFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/EmergencyFilter.php @@ -28,7 +28,9 @@ class EmergencyFilter implements FilterInterface private const DEFAULT_CHOICE = 'false'; - public function __construct(private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/LocationTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/LocationTypeFilter.php index 771dfca30..144e79913 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/LocationTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/LocationTypeFilter.php @@ -21,7 +21,9 @@ use Symfony\Component\Form\FormBuilderInterface; class LocationTypeFilter implements FilterInterface { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php index b8ce3259f..5e2ee5cbe 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php @@ -26,7 +26,9 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInterface { - public function __construct(protected TranslatableStringHelper $translatableStringHelper, protected ActivityReasonRepository $activityReasonRepository) {} + public function __construct(protected TranslatableStringHelper $translatableStringHelper, protected ActivityReasonRepository $activityReasonRepository) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php index eb2312c0e..c424bec31 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php @@ -32,7 +32,8 @@ final readonly class PersonHavingActivityBetweenDateFilter implements ExportElem private TranslatableStringHelper $translatableStringHelper, private ActivityReasonRepository $activityReasonRepository, private RollingDateConverterInterface $rollingDateConverter, - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/PersonsFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonsFilter.php index 8bdefeb24..51dd60855 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/PersonsFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonsFilter.php @@ -26,7 +26,9 @@ final readonly class PersonsFilter implements FilterInterface { private const PREFIX = 'act_persons_filter'; - public function __construct(private PersonRenderInterface $personRender) {} + public function __construct(private PersonRenderInterface $personRender) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/SentReceivedFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/SentReceivedFilter.php index 3011627e8..6eee28790 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/SentReceivedFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/SentReceivedFilter.php @@ -29,7 +29,9 @@ class SentReceivedFilter implements FilterInterface private const DEFAULT_CHOICE = Activity::SENTRECEIVED_SENT; - public function __construct(private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/UserFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/UserFilter.php index 6e6b745b9..54fb87b81 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/UserFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/UserFilter.php @@ -21,7 +21,9 @@ use Symfony\Component\Form\FormBuilderInterface; class UserFilter implements FilterInterface { - public function __construct(private readonly UserRender $userRender) {} + public function __construct(private readonly UserRender $userRender) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php index 23bd4f84c..ae21482fc 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php @@ -28,7 +28,8 @@ class UsersJobFilter implements FilterInterface public function __construct( private readonly TranslatableStringHelperInterface $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php index 4ce9c845a..61a813dc0 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php @@ -30,7 +30,8 @@ class UsersScopeFilter implements FilterInterface public function __construct( private readonly ScopeRepositoryInterface $scopeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index 03a21a5b7..d322089c8 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -183,6 +183,7 @@ class ActivityType extends AbstractType $builder->add('attendee', EntityType::class, [ 'label' => $activityType->getLabel('attendee'), 'required' => $activityType->isRequired('attendee'), + 'placeholder' => false, 'expanded' => true, 'class' => ActivityPresence::class, 'choice_label' => fn (ActivityPresence $activityPresence) => $this->translatableStringHelper->localize($activityPresence->getName()), @@ -404,7 +405,7 @@ class ActivityType extends AbstractType ->setAllowedTypes('center', ['null', Center::class, 'array']) ->setAllowedTypes('role', ['string']) ->setAllowedTypes('activityType', \Chill\ActivityBundle\Entity\ActivityType::class) - ->setAllowedTypes('accompanyingPeriod', [\Chill\PersonBundle\Entity\AccompanyingPeriod::class, 'null']); + ->setAllowedTypes('accompanyingPeriod', [AccompanyingPeriod::class, 'null']); } public function getBlockPrefix(): string diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php b/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php index 8e8ae51f7..b4baa2f54 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php @@ -25,7 +25,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class ActivityTypeType extends AbstractType { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillActivityBundle/Form/Type/PickActivityReasonType.php b/src/Bundle/ChillActivityBundle/Form/Type/PickActivityReasonType.php index be1e372f1..009d7b29f 100644 --- a/src/Bundle/ChillActivityBundle/Form/Type/PickActivityReasonType.php +++ b/src/Bundle/ChillActivityBundle/Form/Type/PickActivityReasonType.php @@ -28,7 +28,8 @@ class PickActivityReasonType extends AbstractType private readonly ActivityReasonRepository $activityReasonRepository, private readonly ActivityReasonRender $reasonRender, private readonly TranslatableStringHelperInterface $translatableStringHelper - ) {} + ) { + } public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategoryType.php b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategoryType.php index ee1417bfb..d94ac34e1 100644 --- a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategoryType.php +++ b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategoryType.php @@ -23,7 +23,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class TranslatableActivityReasonCategoryType extends AbstractType { - public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatorInterface $translator) + { + } public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityType.php b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityType.php index 5c77e500d..e2233f3b1 100644 --- a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityType.php @@ -20,7 +20,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class TranslatableActivityType extends AbstractType { - public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected ActivityTypeRepositoryInterface $activityTypeRepository) {} + public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected ActivityTypeRepositoryInterface $activityTypeRepository) + { + } public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php index b4990c0e3..bae2b0577 100644 --- a/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php @@ -23,7 +23,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(protected Security $security, protected TranslatorInterface $translator) {} + public function __construct(protected Security $security, protected TranslatorInterface $translator) + { + } public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php index 0afe11cfc..8337a3582 100644 --- a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php @@ -20,7 +20,9 @@ use Symfony\Component\Security\Core\Security; */ final readonly class AdminMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private Security $security) {} + public function __construct(private Security $security) + { + } public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php index e76aaf5ee..180247808 100644 --- a/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php @@ -23,11 +23,13 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ final readonly class PersonMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private AuthorizationCheckerInterface $authorizationChecker, private TranslatorInterface $translator) {} + public function __construct(private AuthorizationCheckerInterface $authorizationChecker, private TranslatorInterface $translator) + { + } public function buildMenu($menuId, MenuItem $menu, array $parameters) { - /** @var \Chill\PersonBundle\Entity\Person $person */ + /** @var Person $person */ $person = $parameters['person']; if ($this->authorizationChecker->isGranted(ActivityVoter::SEE, $person)) { diff --git a/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationHandler.php b/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationHandler.php index 8eb219fd2..55b831d8b 100644 --- a/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationHandler.php +++ b/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationHandler.php @@ -18,7 +18,9 @@ use Chill\MainBundle\Notification\NotificationHandlerInterface; final readonly class ActivityNotificationHandler implements NotificationHandlerInterface { - public function __construct(private ActivityRepository $activityRepository) {} + public function __construct(private ActivityRepository $activityRepository) + { + } public function getTemplate(Notification $notification, array $options = []): string { diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php index 231ad5432..1f50f7d62 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php @@ -44,7 +44,8 @@ final readonly class ActivityACLAwareRepository implements ActivityACLAwareRepos private EntityManagerInterface $em, private Security $security, private RequestStack $requestStack, - ) {} + ) { + } /** * @throws NonUniqueResultException diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityDocumentACLAwareRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityDocumentACLAwareRepository.php index 99e75f2da..38bb42e51 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityDocumentACLAwareRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityDocumentACLAwareRepository.php @@ -33,7 +33,8 @@ final readonly class ActivityDocumentACLAwareRepository implements ActivityDocum private CenterResolverManagerInterface $centerResolverManager, private AuthorizationHelperForCurrentUserInterface $authorizationHelperForCurrentUser, private Security $security - ) {} + ) { + } public function buildFetchQueryActivityDocumentLinkedToPersonFromPersonContext(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQueryInterface { diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php index 46e466ae1..6c3675011 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php @@ -51,7 +51,8 @@ class ActivityContext implements private readonly BaseContextData $baseContextData, private readonly ThirdPartyRender $thirdPartyRender, private readonly ThirdPartyRepository $thirdPartyRepository - ) {} + ) { + } public function adminFormReverseTransform(array $data): array { diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php index 221d1f4b2..33675754a 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php @@ -56,7 +56,8 @@ class ListActivitiesByAccompanyingPeriodContext implements private readonly ThirdPartyRepository $thirdPartyRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly UserRepository $userRepository - ) {} + ) { + } public function adminFormReverseTransform(array $data): array { diff --git a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/AccompanyingPeriodActivityGenericDocProvider.php b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/AccompanyingPeriodActivityGenericDocProvider.php index 2c6c9a691..ff198b345 100644 --- a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/AccompanyingPeriodActivityGenericDocProvider.php +++ b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/AccompanyingPeriodActivityGenericDocProvider.php @@ -34,7 +34,8 @@ final readonly class AccompanyingPeriodActivityGenericDocProvider implements Gen private EntityManagerInterface $em, private Security $security, private ActivityDocumentACLAwareRepositoryInterface $activityDocumentACLAwareRepository, - ) {} + ) { + } public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface { diff --git a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/PersonActivityGenericDocProvider.php b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/PersonActivityGenericDocProvider.php index b84345375..1b0ed507b 100644 --- a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/PersonActivityGenericDocProvider.php +++ b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Providers/PersonActivityGenericDocProvider.php @@ -25,7 +25,8 @@ final readonly class PersonActivityGenericDocProvider implements GenericDocForPe public function __construct( private Security $security, private ActivityDocumentACLAwareRepositoryInterface $personActivityDocumentACLAwareRepository, - ) {} + ) { + } public function buildFetchQueryForPerson(Person $person, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface { diff --git a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Renderers/AccompanyingPeriodActivityGenericDocRenderer.php b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Renderers/AccompanyingPeriodActivityGenericDocRenderer.php index 93649cea8..76f0fc00d 100644 --- a/src/Bundle/ChillActivityBundle/Service/GenericDoc/Renderers/AccompanyingPeriodActivityGenericDocRenderer.php +++ b/src/Bundle/ChillActivityBundle/Service/GenericDoc/Renderers/AccompanyingPeriodActivityGenericDocRenderer.php @@ -20,7 +20,9 @@ use Chill\DocStoreBundle\Repository\StoredObjectRepository; final readonly class AccompanyingPeriodActivityGenericDocRenderer implements GenericDocRendererInterface { - public function __construct(private StoredObjectRepository $objectRepository, private ActivityRepository $activityRepository) {} + public function __construct(private StoredObjectRepository $objectRepository, private ActivityRepository $activityRepository) + { + } public function supports(GenericDocDTO $genericDocDTO, $options = []): bool { diff --git a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php index 38aa49cdf..31012569a 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php @@ -310,7 +310,7 @@ final class ActivityControllerTest extends WebTestCase } /** - * @return \Chill\ActivityBundle\Entity\ActivityType + * @return ActivityType */ private function getRandomActivityType() { diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityPresenceAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityPresenceAggregatorTest.php new file mode 100644 index 000000000..ea2bafb0d --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityPresenceAggregatorTest.php @@ -0,0 +1,62 @@ +translatableStringHelper = self::$container->get(TranslatableStringHelperInterface::class); + $this->activityPresenceRepository = self::$container->get(ActivityPresenceRepositoryInterface::class); + } + + public function getAggregator() + { + return new ActivityPresenceAggregator($this->activityPresenceRepository, $this->translatableStringHelper); + } + + public function getFormData() + { + return [ + [], + ]; + } + + public function getQueryBuilders() + { + self::bootKernel(); + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('count(activity.id)') + ->from(Activity::class, 'activity'), + ]; + } +} diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonAggregators/PersonAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonAggregators/PersonAggregatorTest.php new file mode 100644 index 000000000..388f13793 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/PersonAggregators/PersonAggregatorTest.php @@ -0,0 +1,57 @@ +labelPersonHelper = self::$container->get(LabelPersonHelper::class); + } + + public function getAggregator() + { + return new PersonAggregator($this->labelPersonHelper); + } + + public function getFormData() + { + return [[]]; + } + + public function getQueryBuilders() + { + self::bootKernel(); + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('count(activity.id)') + ->from(Activity::class, 'activity'), + ]; + } +} diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountHouseholdOnActivityTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountHouseholdOnActivityTest.php new file mode 100644 index 000000000..132813176 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountHouseholdOnActivityTest.php @@ -0,0 +1,60 @@ +entityManager = self::$container->get(EntityManagerInterface::class); + } + + public function getExport() + { + yield new CountHouseholdOnActivity($this->entityManager, $this->getParameters(true)); + yield new CountHouseholdOnActivity($this->entityManager, $this->getParameters(false)); + } + + public function getFormData() + { + return [ + [], + ]; + } + + public function getModifiersCombination() + { + return [ + [ + Declarations::ACTIVITY, + Declarations::ACTIVITY_ACP, + PersonDeclarations::ACP_TYPE, + PersonDeclarations::PERSON_TYPE, + PersonDeclarations::HOUSEHOLD_TYPE, + ], + ]; + } +} diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountPersonsOnActivityTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountPersonsOnActivityTest.php new file mode 100644 index 000000000..25d6643fb --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToACP/CountPersonsOnActivityTest.php @@ -0,0 +1,54 @@ +get(EntityManagerInterface::class); + + yield new CountPersonsOnActivity($em, $this->getParameters(true)); + yield new CountPersonsOnActivity($em, $this->getParameters(false)); + } + + public function getFormData() + { + return [[]]; + } + + public function getModifiersCombination() + { + return [[ + Declarations::ACTIVITY, + Declarations::ACTIVITY_ACP, + PersonDeclarations::ACP_TYPE, + PersonDeclarations::PERSON_TYPE, + ]]; + } +} diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/CountHouseholdOnActivityTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/CountHouseholdOnActivityTest.php new file mode 100644 index 000000000..65fdc6c4c --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Export/LinkedToPerson/CountHouseholdOnActivityTest.php @@ -0,0 +1,59 @@ +activityRepository = self::$container->get(ActivityRepository::class); + } + + public function getExport() + { + yield new CountHouseholdOnActivity($this->activityRepository, $this->getParameters(true)); + yield new CountHouseholdOnActivity($this->activityRepository, $this->getParameters(false)); + } + + public function getFormData() + { + return [ + [], + ]; + } + + public function getModifiersCombination() + { + return [ + [ + Declarations::ACTIVITY, + Declarations::ACTIVITY_PERSON, + PersonDeclarations::PERSON_TYPE, + PersonDeclarations::HOUSEHOLD_TYPE, + ], + ]; + } +} diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/ActivityTypeFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/ActivityTypeFilterTest.php index 347d7466f..3701459da 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/ActivityTypeFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ACPFilters/ActivityTypeFilterTest.php @@ -13,6 +13,7 @@ namespace Chill\ActivityBundle\Tests\Export\Filter\ACPFilters; use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Entity\ActivityType; +use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Test\Export\AbstractFilterTest; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Doctrine\Common\Collections\ArrayCollection; @@ -55,8 +56,30 @@ final class ActivityTypeFilterTest extends AbstractFilterTest $data = []; foreach ($array as $a) { + $data[] = [ + 'accepted_activitytypes' => [], + 'date_after' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), + 'date_before' => new RollingDate(RollingDate::T_TODAY), + ]; $data[] = [ 'accepted_activitytypes' => new ArrayCollection([$a]), + 'date_after' => null, + 'date_before' => null, + ]; + $data[] = [ + 'accepted_activitytypes' => [$a], + 'date_after' => null, + 'date_before' => null, + ]; + $data[] = [ + 'accepted_activitytypes' => [$a], + 'date_after' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), + 'date_before' => new RollingDate(RollingDate::T_TODAY), + ]; + $data[] = [ + 'accepted_activitytypes' => [], + 'date_after' => null, + 'date_before' => null, ]; } diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityPresenceFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityPresenceFilterTest.php new file mode 100644 index 000000000..6fc3d10d8 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityPresenceFilterTest.php @@ -0,0 +1,76 @@ +translator = self::$container->get(TranslatorInterface::class); + $this->translatableStringHelper = self::$container->get(TranslatableStringHelperInterface::class); + } + + public function getFilter() + { + return new ActivityPresenceFilter($this->translatableStringHelper, $this->translator); + } + + public function getFormData() + { + self::bootKernel(); + + $presences = self::$container->get(ActivityPresenceRepositoryInterface::class) + ->findAll(); + + return [ + [ + 'presences' => $presences, + ], + [ + 'presences' => new ArrayCollection($presences), + ], + ]; + } + + public function getQueryBuilders() + { + self::bootKernel(); + + $em = self::$container->get(EntityManagerInterface::class); + + yield $em->createQueryBuilder() + ->select('count(activity.id)') + ->from(Activity::class, 'activity'); + + self::ensureKernelShutdown(); + } +} diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php index a2ea7c158..a9935eea4 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php @@ -35,7 +35,7 @@ final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest $this->filter = self::$container->get('chill.activity.export.person_having_an_activity_between_date_filter'); $request = $this->prophesize() - ->willExtend(\Symfony\Component\HttpFoundation\Request::class); + ->willExtend(Request::class); $request->getLocale()->willReturn('fr'); diff --git a/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityTypeTest.php b/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityTypeTest.php index 80779d909..f3163f664 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityTypeTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityTypeTest.php @@ -58,7 +58,7 @@ final class TranslatableActivityTypeTest extends KernelTestCase $this->assertTrue($form->isSynchronized()); $this->assertInstanceOf( - \Chill\ActivityBundle\Entity\ActivityType::class, + ActivityType::class, $form->getData()['type'], 'The data is an instance of Chill\\ActivityBundle\\Entity\\ActivityType' ); @@ -83,7 +83,7 @@ final class TranslatableActivityTypeTest extends KernelTestCase } /** - * @return \Chill\ActivityBundle\Entity\ActivityType + * @return ActivityType */ protected function getRandomType(mixed $active = true) { diff --git a/src/Bundle/ChillActivityBundle/config/services/export.yaml b/src/Bundle/ChillActivityBundle/config/services/export.yaml index 29f7c2625..ef691ba0d 100644 --- a/src/Bundle/ChillActivityBundle/config/services/export.yaml +++ b/src/Bundle/ChillActivityBundle/config/services/export.yaml @@ -16,6 +16,18 @@ services: tags: - { name: chill.export, alias: 'list_activity_linked_to_person' } + Chill\ActivityBundle\Export\Export\LinkedToACP\CountPersonsOnActivity: + tags: + - { name: chill.export, alias: 'count_person_on_activity' } + + Chill\ActivityBundle\Export\Export\LinkedToACP\CountHouseholdOnActivity: + tags: + - { name: chill.export, alias: 'count_household_on_activity_acp' } + + Chill\ActivityBundle\Export\Export\LinkedToPerson\CountHouseholdOnActivity: + tags: + - { name: chill.export, alias: 'count_household_on_activity_person' } + chill.activity.export.count_activity_linked_to_acp: class: Chill\ActivityBundle\Export\Export\LinkedToACP\CountActivity tags: @@ -135,6 +147,11 @@ services: tags: - { name: chill.export_filter, alias: 'period_having_activity_betw_dates_filter' } + Chill\ActivityBundle\Export\Filter\ActivityPresenceFilter: + tags: + - { name: chill.export_filter, alias: 'activity_presence_filter' } + + ## Aggregators Chill\ActivityBundle\Export\Aggregator\PersonAggregators\ActivityReasonAggregator: tags: @@ -218,3 +235,11 @@ services: Chill\ActivityBundle\Export\Aggregator\ACPAggregators\ByActivityTypeAggregator: tags: - { name: chill.export_aggregator, alias: acp_by_activity_type_aggregator } + + Chill\ActivityBundle\Export\Aggregator\ActivityPresenceAggregator: + tags: + - { name: chill.export_aggregator, alias: activity_presence_agg } + + Chill\ActivityBundle\Export\Aggregator\PersonAggregators\PersonAggregator: + tags: + - { name: chill.export_aggregator, alias: activity_person_agg } diff --git a/src/Bundle/ChillActivityBundle/translations/messages+intl-icu.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages+intl-icu.fr.yml index 7c02e29c6..0807861cc 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages+intl-icu.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages+intl-icu.fr.yml @@ -3,7 +3,12 @@ export: activity: course_having_activity_between_date: Only course having an activity between from and to: Seulement les parcours ayant reçu au moins un échange entre le {from, date, short} et le {to, date, short} - person_between_dates: + + acp_by_activity_type: + 'acp_containing_at_least_one_activitytypes': >- + Parcours filtrés: uniquement ceux qui contiennent au moins un échange d'un des types suivants: {activitytypes} + {has_date_after, select, 1 {, après le {date_after, date}} other {}} + {has_date_before, select, 1 {, avant le {date_before, date}} other {}} describe_action_with_no_subject: >- Filtré par personne ayant eu un échange entre le {date_from, date} et le {date_to, date} describe_action_with_subject: >- diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 759d222c1..6d447ea21 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -332,6 +332,19 @@ docgen: myWorksOnly: Prendre en compte uniquement les actions d'accompagnement dont je suis référent export: + export: + count_person_on_activity: + title: Nombre d'usagers concernés par les échanges + description: Compte le nombre d'usagers concernés par les échanges. Si un usager est présent dans plusieurs échanges, il n'est comptabilisé qu'une seule fois. + header: Nombre d'usagers concernés par des échanges + count_household_on_activity: + title: Nombre de ménages concernés par les échanges + description: Compte le nombre de ménages concernés par les échanges. Si un ménage est présent dans plusieurs échanges, il n'est comptabilisé qu'une seule fois. Les usagers sans ménages ne sont pas comptabilisés. + header: Nombre de ménage concernés par des échanges + count_household_on_activity_person: + title: Nombre de ménages concernés par les échanges + description: Compte le nombre de ménages concernés par les échanges. Si un ménage est présent dans plusieurs échanges, il n'est comptabilisé qu'une seule fois. Les usagers sans ménages ne sont pas comptabilisés. Lorsqu'un usager change de ménage, chaque ménage est comptabilisé une fois. + header: Nombre de ménage concernés par des échanges list: activity: users name: Nom des utilisateurs @@ -366,7 +379,10 @@ export: Receiving an activity after: Ayant reçu un échange après le Receiving an activity before: Ayant reçu un échange avant le acp_by_activity_type: - 'acp_containing_at_least_one_%activitytypes%': 'Parcours filtrés: uniquement ceux qui contiennent au moins un échange d''un des types suivants: %activitytypes%' + 'activity after': Échanges après le + activity after help: Si laissé vide, ne sera pas pris en compte + activity before: Echanges avant le + activity before help: Si laissé vide, ne sera pas pris en compte person_between_dates: Implied in an activity after this date: Impliqué dans un échange après cette date Implied in an activity before this date: Impliqué dans un échange avant cette date @@ -389,8 +405,16 @@ export: Sent or received: Envoyé ou reçu is sent: envoyé is received: reçu + by_presence: + Filter activity by activity presence: Filtrer les échanges par présence de l'usager + presences: Présences + 'Filtered by activity presence: only %presences%': 'Filtré par présence de l''usager: seulement %presences%' aggregator: + person: + by_person: + title: Grouper les échanges par usager (dossier d'usager dans lequel l'échange est enregistré) + person: Usager acp: by_activity_type: title: Grouper les parcours par type d'échange @@ -421,6 +445,9 @@ export: by_persons: Group activity by persons: Grouper les échanges par usager participant Persons: Usagers participants + by_activity_presence: + Group activity by presence: Grouper les échanges par présence de l'usager + header: Présence de(s) usager(s) generic_doc: filter: diff --git a/src/Bundle/ChillAsideActivityBundle/src/ChillAsideActivityBundle.php b/src/Bundle/ChillAsideActivityBundle/src/ChillAsideActivityBundle.php index b0951e502..6917517b7 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/ChillAsideActivityBundle.php +++ b/src/Bundle/ChillAsideActivityBundle/src/ChillAsideActivityBundle.php @@ -13,4 +13,6 @@ namespace Chill\AsideActivityBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; -class ChillAsideActivityBundle extends Bundle {} +class ChillAsideActivityBundle extends Bundle +{ +} diff --git a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php index c29a5a6dc..0a7891a07 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php @@ -20,7 +20,9 @@ use Symfony\Component\HttpFoundation\Request; final class AsideActivityController extends CRUDController { - public function __construct(private readonly AsideActivityCategoryRepository $categoryRepository) {} + public function __construct(private readonly AsideActivityCategoryRepository $categoryRepository) + { + } public function createEntity(string $action, Request $request): object { diff --git a/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php index 12c82be00..7bc6b774f 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php @@ -20,7 +20,9 @@ use Doctrine\Persistence\ObjectManager; class LoadAsideActivity extends Fixture implements DependentFixtureInterface { - public function __construct(private readonly UserRepository $userRepository) {} + public function __construct(private readonly UserRepository $userRepository) + { + } public function getDependencies(): array { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByActivityTypeAggregator.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByActivityTypeAggregator.php index 4271ae118..43b702f5c 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByActivityTypeAggregator.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByActivityTypeAggregator.php @@ -23,7 +23,8 @@ class ByActivityTypeAggregator implements AggregatorInterface public function __construct( private readonly AsideActivityCategoryRepository $asideActivityCategoryRepository, private readonly TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByLocationAggregator.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByLocationAggregator.php index b5ca1022b..095d20acb 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByLocationAggregator.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByLocationAggregator.php @@ -19,7 +19,9 @@ use Symfony\Component\Form\FormBuilderInterface; class ByLocationAggregator implements AggregatorInterface { - public function __construct(private readonly LocationRepository $locationRepository) {} + public function __construct(private readonly LocationRepository $locationRepository) + { + } public function buildForm(FormBuilderInterface $builder): void { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserJobAggregator.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserJobAggregator.php index c3883b18a..94d946907 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserJobAggregator.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserJobAggregator.php @@ -27,7 +27,8 @@ class ByUserJobAggregator implements AggregatorInterface public function __construct( private readonly UserJobRepositoryInterface $userJobRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { @@ -65,7 +66,9 @@ class ByUserJobAggregator implements AggregatorInterface return Declarations::ASIDE_ACTIVITY_TYPE; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserScopeAggregator.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserScopeAggregator.php index a99d2b75f..90e4ee615 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserScopeAggregator.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserScopeAggregator.php @@ -27,7 +27,8 @@ class ByUserScopeAggregator implements AggregatorInterface public function __construct( private readonly ScopeRepositoryInterface $scopeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { @@ -64,7 +65,9 @@ class ByUserScopeAggregator implements AggregatorInterface return Declarations::ASIDE_ACTIVITY_TYPE; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/AvgAsideActivityDuration.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/AvgAsideActivityDuration.php index 70922b6ae..f4afd9181 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/AvgAsideActivityDuration.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/AvgAsideActivityDuration.php @@ -22,9 +22,13 @@ use Symfony\Component\Form\FormBuilderInterface; class AvgAsideActivityDuration implements ExportInterface, GroupedExportInterface { - public function __construct(private readonly AsideActivityRepository $repository) {} + public function __construct(private readonly AsideActivityRepository $repository) + { + } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/CountAsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/CountAsideActivity.php index 6d1eed5fe..b8f3101b7 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/CountAsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/CountAsideActivity.php @@ -22,9 +22,13 @@ use Symfony\Component\Form\FormBuilderInterface; class CountAsideActivity implements ExportInterface, GroupedExportInterface { - public function __construct(private readonly AsideActivityRepository $repository) {} + public function __construct(private readonly AsideActivityRepository $repository) + { + } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php index 33155c62f..37519b559 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php @@ -42,9 +42,12 @@ final readonly class ListAsideActivity implements ListInterface, GroupedExportIn private CategoryRender $categoryRender, private LocationRepository $locationRepository, private TranslatableStringHelperInterface $translatableStringHelper - ) {} + ) { + } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumAsideActivityDuration.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumAsideActivityDuration.php index 0fd318902..872d7305c 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumAsideActivityDuration.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumAsideActivityDuration.php @@ -22,9 +22,13 @@ use Symfony\Component\Form\FormBuilderInterface; class SumAsideActivityDuration implements ExportInterface, GroupedExportInterface { - public function __construct(private readonly AsideActivityRepository $repository) {} + public function __construct(private readonly AsideActivityRepository $repository) + { + } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php index 708b12ef1..7c1f4348c 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php @@ -28,7 +28,8 @@ class ByActivityTypeFilter implements FilterInterface private readonly CategoryRender $categoryRender, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly AsideActivityCategoryRepository $asideActivityTypeRepository - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php index 8f3c9c305..703190f74 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php @@ -13,20 +13,18 @@ namespace Chill\AsideActivityBundle\Export\Filter; use Chill\AsideActivityBundle\Export\Declarations; use Chill\MainBundle\Export\FilterInterface; -use Chill\MainBundle\Form\Type\Export\FilterType; use Chill\MainBundle\Form\Type\PickRollingDateType; use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\Form\FormError; -use Symfony\Component\Form\FormEvent; -use Symfony\Component\Form\FormEvents; use Symfony\Contracts\Translation\TranslatorInterface; class ByDateFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, protected TranslatorInterface $translator) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, protected TranslatorInterface $translator) + { + } public function addRole(): ?string { @@ -66,51 +64,14 @@ class ByDateFilter implements FilterInterface ->add('date_to', PickRollingDateType::class, [ 'label' => 'export.filter.Aside activities before this date', ]); - - $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { - /** @var \Symfony\Component\Form\FormInterface $filterForm */ - $filterForm = $event->getForm()->getParent(); - $enabled = $filterForm->get(FilterType::ENABLED_FIELD)->getData(); - - if (true === $enabled) { - // if the filter is enabled, add some validation - $form = $event->getForm(); - $date_from = $form->get('date_from')->getData(); - $date_to = $form->get('date_to')->getData(); - - // check that fields are not empty - if (null === $date_from) { - $form->get('date_from')->addError(new FormError( - $this->translator->trans('This field ' - .'should not be empty') - )); - } - - if (null === $date_to) { - $form->get('date_to')->addError(new FormError( - $this->translator->trans('This field ' - .'should not be empty') - )); - } - - // check that date_from is before date_to - if ( - (null !== $date_from && null !== $date_to) - && $date_from >= $date_to - ) { - $form->get('date_to')->addError(new FormError( - $this->translator->trans('export.filter.This date should be after ' - .'the date given in "Implied in an aside activity after ' - .'this date" field') - )); - } - } - }); } public function getFormDefaultData(): array { - return ['date_from' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), 'date_to' => new RollingDate(RollingDate::T_TODAY)]; + return [ + 'date_from' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), + 'date_to' => new RollingDate(RollingDate::T_TODAY), + ]; } public function describeAction($data, $format = 'string'): array diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByLocationFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByLocationFilter.php index 6de002606..20e8c46f8 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByLocationFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByLocationFilter.php @@ -25,7 +25,8 @@ final readonly class ByLocationFilter implements FilterInterface { public function __construct( private Security $security - ) {} + ) { + } public function getTitle(): string { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php index 8dd1a8eac..e39633914 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; class ByUserFilter implements FilterInterface { - public function __construct(private readonly UserRender $userRender) {} + public function __construct(private readonly UserRender $userRender) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php index d7255d9fa..2418f5428 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php @@ -28,7 +28,8 @@ class ByUserJobFilter implements FilterInterface public function __construct( private readonly TranslatableStringHelperInterface $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php index 8f8d50462..fd0511e33 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php @@ -30,7 +30,8 @@ class ByUserScopeFilter implements FilterInterface public function __construct( private readonly ScopeRepositoryInterface $scopeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php index 3a69be137..c285f0f9b 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php @@ -22,7 +22,9 @@ use Symfony\Component\Form\FormBuilderInterface; final class AsideActivityCategoryType extends AbstractType { - public function __construct(private readonly CategoryRender $categoryRender) {} + public function __construct(private readonly CategoryRender $categoryRender) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/Type/PickAsideActivityCategoryType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/Type/PickAsideActivityCategoryType.php index 23923fb6c..8341d8595 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/Type/PickAsideActivityCategoryType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/Type/PickAsideActivityCategoryType.php @@ -20,7 +20,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; final class PickAsideActivityCategoryType extends AbstractType { - public function __construct(private readonly CategoryRender $categoryRender) {} + public function __construct(private readonly CategoryRender $categoryRender) + { + } public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php b/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php index 43a37e068..d0a593dab 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php @@ -16,7 +16,9 @@ use Symfony\Component\Security\Core\Security; final readonly class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface { - public function __construct(private Security $security) {} + public function __construct(private Security $security) + { + } public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php b/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php index a32d52303..0646a8613 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php @@ -21,7 +21,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class SectionMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(protected TranslatorInterface $translator, public AuthorizationCheckerInterface $authorizationChecker) {} + public function __construct(protected TranslatorInterface $translator, public AuthorizationCheckerInterface $authorizationChecker) + { + } public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php index 2598c4e01..db8995087 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php @@ -26,7 +26,9 @@ final readonly class CategoryRender implements ChillEntityRenderInterface public const SEPERATOR_KEY = 'default.separator'; - public function __construct(private TranslatableStringHelper $translatableStringHelper, private \Twig\Environment $engine) {} + public function __construct(private TranslatableStringHelper $translatableStringHelper, private \Twig\Environment $engine) + { + } public function buildParents(AsideActivityCategory $asideActivityCategory) { diff --git a/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php b/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php index 38d4d82f5..5282d6bce 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php @@ -25,7 +25,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; abstract class AbstractElementController extends AbstractController { - public function __construct(protected EntityManagerInterface $em, protected TranslatorInterface $translator, protected LoggerInterface $chillMainLogger) {} + public function __construct(protected EntityManagerInterface $em, protected TranslatorInterface $translator, protected LoggerInterface $chillMainLogger) + { + } /** * Route( diff --git a/src/Bundle/ChillBudgetBundle/Controller/Admin/ChargeKindController.php b/src/Bundle/ChillBudgetBundle/Controller/Admin/ChargeKindController.php index 642b7cc61..a84d54e40 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/Admin/ChargeKindController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/Admin/ChargeKindController.php @@ -23,6 +23,6 @@ class ChargeKindController extends CRUDController /* @var QueryBuilder $query */ $query->addOrderBy('e.ordering', 'ASC'); - return $query; + return parent::orderQuery($action, $query, $request, $paginator); } } diff --git a/src/Bundle/ChillBudgetBundle/Controller/Admin/ResourceKindController.php b/src/Bundle/ChillBudgetBundle/Controller/Admin/ResourceKindController.php index 0762f8252..ffef467f9 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/Admin/ResourceKindController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/Admin/ResourceKindController.php @@ -23,6 +23,6 @@ class ResourceKindController extends CRUDController /* @var QueryBuilder $query */ $query->addOrderBy('e.ordering', 'ASC'); - return $query; + return parent::orderQuery($action, $query, $request, $paginator); } } diff --git a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php index 26acbf8a5..468576673 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php @@ -21,7 +21,9 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; class ElementController extends AbstractController { - public function __construct(private readonly CalculatorManager $calculator, private readonly ResourceRepository $resourceRepository, private readonly ChargeRepository $chargeRepository) {} + public function __construct(private readonly CalculatorManager $calculator, private readonly ResourceRepository $resourceRepository, private readonly ChargeRepository $chargeRepository) + { + } /** * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/elements/by-person/{id}", name="chill_budget_elements_index") diff --git a/src/Bundle/ChillBudgetBundle/Form/ChargeType.php b/src/Bundle/ChillBudgetBundle/Form/ChargeType.php index 2d219b62a..c2f2e4b67 100644 --- a/src/Bundle/ChillBudgetBundle/Form/ChargeType.php +++ b/src/Bundle/ChillBudgetBundle/Form/ChargeType.php @@ -27,7 +27,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ChargeType extends AbstractType { - public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private readonly ChargeKindRepository $repository, private readonly TranslatorInterface $translator) {} + public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private readonly ChargeKindRepository $repository, private readonly TranslatorInterface $translator) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillBudgetBundle/Form/ResourceType.php b/src/Bundle/ChillBudgetBundle/Form/ResourceType.php index ba93f1080..3896b0dd8 100644 --- a/src/Bundle/ChillBudgetBundle/Form/ResourceType.php +++ b/src/Bundle/ChillBudgetBundle/Form/ResourceType.php @@ -26,7 +26,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ResourceType extends AbstractType { - public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private readonly ResourceKindRepository $repository, private readonly TranslatorInterface $translator) {} + public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private readonly ResourceKindRepository $repository, private readonly TranslatorInterface $translator) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php index b8b4b617c..805ad865d 100644 --- a/src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php @@ -17,7 +17,9 @@ use Symfony\Component\Security\Core\Security; final readonly class AdminMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private Security $security) {} + public function __construct(private Security $security) + { + } public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillBudgetBundle/Menu/HouseholdMenuBuilder.php b/src/Bundle/ChillBudgetBundle/Menu/HouseholdMenuBuilder.php index 94583b439..c5d19262d 100644 --- a/src/Bundle/ChillBudgetBundle/Menu/HouseholdMenuBuilder.php +++ b/src/Bundle/ChillBudgetBundle/Menu/HouseholdMenuBuilder.php @@ -20,7 +20,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class HouseholdMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator) {} + public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator) + { + } public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillBudgetBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillBudgetBundle/Menu/PersonMenuBuilder.php index 25bd6a218..97b10c72b 100644 --- a/src/Bundle/ChillBudgetBundle/Menu/PersonMenuBuilder.php +++ b/src/Bundle/ChillBudgetBundle/Menu/PersonMenuBuilder.php @@ -20,7 +20,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class PersonMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator) {} + public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator) + { + } public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php b/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php index a57f7fb29..acac8a504 100644 --- a/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php +++ b/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php @@ -34,7 +34,9 @@ final readonly class SummaryBudget implements SummaryBudgetInterface private const QUERY_RESOURCE_BY_PERSON = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, resource_id AS kind_id FROM chill_budget.resource WHERE person_id = ? AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY resource_id'; - public function __construct(private EntityManagerInterface $em, private TranslatableStringHelperInterface $translatableStringHelper, private ResourceKindRepositoryInterface $resourceKindRepository, private ChargeKindRepositoryInterface $chargeKindRepository) {} + public function __construct(private EntityManagerInterface $em, private TranslatableStringHelperInterface $translatableStringHelper, private ResourceKindRepositoryInterface $resourceKindRepository, private ChargeKindRepositoryInterface $chargeKindRepository) + { + } public function getSummaryForHousehold(?Household $household): array { diff --git a/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php b/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php index 26871b0f4..c8fa90475 100644 --- a/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php +++ b/src/Bundle/ChillBudgetBundle/Templating/BudgetElementTypeRender.php @@ -21,7 +21,9 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface; */ final readonly class BudgetElementTypeRender implements ChillEntityRenderInterface { - public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private \Twig\Environment $engine) {} + public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private \Twig\Environment $engine) + { + } public function renderBox($entity, array $options): string { diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php index 1729c215b..96344103f 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php @@ -23,7 +23,9 @@ use Symfony\Component\Routing\Annotation\Route; class CalendarAPIController extends ApiController { - public function __construct(private readonly CalendarRepository $calendarRepository) {} + public function __construct(private readonly CalendarRepository $calendarRepository) + { + } /** * @Route("/api/1.0/calendar/calendar/by-user/{id}.{_format}", diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php index f4694614f..b6eaaf377 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php @@ -59,7 +59,8 @@ class CalendarController extends AbstractController private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly UserRepositoryInterface $userRepository, private readonly TranslatorInterface $translator - ) {} + ) { + } /** * Delete a calendar item. @@ -406,7 +407,7 @@ class CalendarController extends AbstractController } /** @var Calendar $entity */ - $entity = $em->getRepository(\Chill\CalendarBundle\Entity\Calendar::class)->find($id); + $entity = $em->getRepository(Calendar::class)->find($id); if (null === $entity) { throw $this->createNotFoundException('Unable to find Calendar entity.'); diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php index d0f5e623d..6bc3245e3 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php @@ -35,7 +35,8 @@ final readonly class CalendarDocController private FormFactoryInterface $formFactory, private Security $security, private UrlGeneratorInterface $urlGenerator, - ) {} + ) { + } /** * @Route("/{_locale}/calendar/calendar-doc/{id}/new", name="chill_calendar_calendardoc_new") diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php index 459d8f6aa..2bdf393f8 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php @@ -23,7 +23,9 @@ use Symfony\Component\Routing\Annotation\Route; class CalendarRangeAPIController extends ApiController { - public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository) {} + public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository) + { + } /** * @Route("/api/1.0/calendar/calendar-range-available/{id}.{_format}", diff --git a/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php b/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php index 784a6f6ce..16950b29e 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php @@ -34,7 +34,9 @@ use Symfony\Component\Security\Core\Security; class InviteApiController { - public function __construct(private readonly EntityManagerInterface $entityManager, private readonly MessageBusInterface $messageBus, private readonly Security $security) {} + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly MessageBusInterface $messageBus, private readonly Security $security) + { + } /** * Give an answer to a calendar invite. diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php index 75b417e93..a8339137a 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php @@ -30,7 +30,9 @@ use TheNetworg\OAuth2\Client\Token\AccessToken; class RemoteCalendarConnectAzureController { - public function __construct(private readonly ClientRegistry $clientRegistry, private readonly OnBehalfOfUserTokenStorage $MSGraphTokenStorage) {} + public function __construct(private readonly ClientRegistry $clientRegistry, private readonly OnBehalfOfUserTokenStorage $MSGraphTokenStorage) + { + } /** * @Route("/{_locale}/connect/azure", name="chill_calendar_remote_connect_azure") diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php index e7d423abd..1582a8a2d 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php @@ -27,7 +27,9 @@ use Symfony\Component\Routing\Annotation\Route; class RemoteCalendarMSGraphSyncController { - public function __construct(private readonly MessageBusInterface $messageBus) {} + public function __construct(private readonly MessageBusInterface $messageBus) + { + } /** * @Route("/public/incoming-hook/calendar/msgraph/events/{userId}", name="chill_calendar_remote_msgraph_incoming_webhook_events", diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php index 673912c0a..eee828884 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php @@ -34,7 +34,9 @@ use Symfony\Component\Serializer\SerializerInterface; */ class RemoteCalendarProxyController { - public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly SerializerInterface $serializer) {} + public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly SerializerInterface $serializer) + { + } /** * @Route("api/1.0/calendar/proxy/calendar/by-user/{id}/events") diff --git a/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php b/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php index f222823bf..71277cd8a 100644 --- a/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php +++ b/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCalendarRange.php @@ -28,7 +28,9 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere { public static array $references = []; - public function __construct(private readonly UserRepository $userRepository) {} + public function __construct(private readonly UserRepository $userRepository) + { + } public static function getGroups(): array { diff --git a/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php b/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php index 82c76eea4..2f263d66a 100644 --- a/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php +++ b/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php @@ -17,7 +17,9 @@ use Symfony\Component\HttpFoundation\RequestStack; class ListenToActivityCreate { - public function __construct(private readonly RequestStack $requestStack) {} + public function __construct(private readonly RequestStack $requestStack) + { + } public function postPersist(Activity $activity, LifecycleEventArgs $event): void { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php index 5e2091fac..43354207c 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class AgentAggregator implements AggregatorInterface { - public function __construct(private UserRepository $userRepository, private UserRender $userRender) {} + public function __construct(private UserRepository $userRepository, private UserRender $userRender) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php index 7c84653d2..7fe83726c 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; class CancelReasonAggregator implements AggregatorInterface { - public function __construct(private readonly CancelReasonRepository $cancelReasonRepository, private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly CancelReasonRepository $cancelReasonRepository, private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php index 76cbe5cd8..1d1c4dca9 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php @@ -27,7 +27,8 @@ final readonly class JobAggregator implements AggregatorInterface public function __construct( private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { @@ -65,7 +66,9 @@ final readonly class JobAggregator implements AggregatorInterface return Declarations::CALENDAR_TYPE; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php index 6481f95b4..aca3e654b 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php @@ -19,7 +19,9 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class LocationAggregator implements AggregatorInterface { - public function __construct(private LocationRepository $locationRepository) {} + public function __construct(private LocationRepository $locationRepository) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php index be9406cfa..1f49ff723 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class LocationTypeAggregator implements AggregatorInterface { - public function __construct(private LocationTypeRepository $locationTypeRepository, private TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private LocationTypeRepository $locationTypeRepository, private TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php index 4998f6d1f..d298e63a4 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php @@ -27,7 +27,8 @@ final readonly class ScopeAggregator implements AggregatorInterface public function __construct( private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { @@ -65,7 +66,9 @@ final readonly class ScopeAggregator implements AggregatorInterface return Declarations::CALENDAR_TYPE; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php index e9213d3cb..47801add3 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php @@ -26,7 +26,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UrgencyAggregator implements AggregatorInterface { - public function __construct(private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php b/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php index f643eaa68..9e7c5e367 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php @@ -27,7 +27,8 @@ class CountCalendars implements ExportInterface, GroupedExportInterface { public function __construct( private readonly CalendarRepository $calendarRepository, - ) {} + ) { + } public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php index b69185a17..f7f19d1e4 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php @@ -24,7 +24,9 @@ use Symfony\Component\Form\FormBuilderInterface; class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface { - public function __construct(private readonly CalendarRepository $calendarRepository) {} + public function __construct(private readonly CalendarRepository $calendarRepository) + { + } public function buildForm(FormBuilderInterface $builder): void { diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php index 8ea23014c..e9920444a 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php @@ -24,7 +24,9 @@ use Symfony\Component\Form\FormBuilderInterface; class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface { - public function __construct(private readonly CalendarRepository $calendarRepository) {} + public function __construct(private readonly CalendarRepository $calendarRepository) + { + } public function buildForm(FormBuilderInterface $builder): void { diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php index c16c148fc..888ee4363 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php @@ -22,7 +22,9 @@ use Symfony\Component\Form\FormBuilderInterface; class AgentFilter implements FilterInterface { - public function __construct(private readonly UserRender $userRender) {} + public function __construct(private readonly UserRender $userRender) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php index 90a004388..1fe9eadc5 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php @@ -21,7 +21,9 @@ use Symfony\Component\Form\FormBuilderInterface; class BetweenDatesFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php index 63149509f..e493ce0bf 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php @@ -34,7 +34,9 @@ class CalendarRangeFilter implements FilterInterface private const DEFAULT_CHOICE = 'false'; - public function __construct(private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php index c122a298d..6b81a709f 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php @@ -27,7 +27,8 @@ final readonly class JobFilter implements FilterInterface public function __construct( private TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php index 93edc1b3a..ef7c14199 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php @@ -29,7 +29,8 @@ class ScopeFilter implements FilterInterface public function __construct( protected TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php index eec0b3f9f..b83bb992d 100644 --- a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php +++ b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php @@ -38,7 +38,8 @@ class CalendarType extends AbstractType private readonly IdToLocationDataTransformer $idToLocationDataTransformer, private readonly ThirdPartiesToIdDataTransformer $partiesToIdDataTransformer, private readonly IdToCalendarRangeDataTransformer $calendarRangeDataTransformer - ) {} + ) { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php index 6dd5bfa52..3997c4dad 100644 --- a/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php @@ -19,7 +19,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private readonly Security $security, protected TranslatorInterface $translator) {} + public function __construct(private readonly Security $security, protected TranslatorInterface $translator) + { + } public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillCalendarBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/PersonMenuBuilder.php index e92a72bb7..c7bbc756c 100644 --- a/src/Bundle/ChillCalendarBundle/Menu/PersonMenuBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Menu/PersonMenuBuilder.php @@ -19,7 +19,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class PersonMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private readonly Security $security, protected TranslatorInterface $translator) {} + public function __construct(private readonly Security $security, protected TranslatorInterface $translator) + { + } public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php index 3a062f7b8..90b94b08e 100644 --- a/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php @@ -18,7 +18,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UserMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private readonly Security $security, public TranslatorInterface $translator) {} + public function __construct(private readonly Security $security, public TranslatorInterface $translator) + { + } public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php index 8f62fdcdb..d0feca3d8 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php @@ -29,7 +29,9 @@ use Symfony\Component\Security\Core\Security; class CalendarEntityListener { - public function __construct(private readonly MessageBusInterface $messageBus, private readonly Security $security) {} + public function __construct(private readonly MessageBusInterface $messageBus, private readonly Security $security) + { + } public function postPersist(Calendar $calendar, PostPersistEventArgs $args): void { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php index 8b875bdcb..cc3bf649e 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php @@ -29,7 +29,9 @@ use Symfony\Component\Security\Core\Security; class CalendarRangeEntityListener { - public function __construct(private readonly MessageBusInterface $messageBus, private readonly Security $security) {} + public function __construct(private readonly MessageBusInterface $messageBus, private readonly Security $security) + { + } public function postPersist(CalendarRange $calendarRange, PostPersistEventArgs $eventArgs): void { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php index 7749d503c..c55bd8144 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeRemoveToRemoteHandler.php @@ -31,7 +31,9 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class CalendarRangeRemoveToRemoteHandler implements MessageHandlerInterface { - public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly UserRepository $userRepository) {} + public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly UserRepository $userRepository) + { + } public function __invoke(CalendarRangeRemovedMessage $calendarRangeRemovedMessage) { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php index c9fd1b939..950ca526d 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRangeToRemoteHandler.php @@ -32,7 +32,9 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class CalendarRangeToRemoteHandler implements MessageHandlerInterface { - public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly EntityManagerInterface $entityManager) {} + public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly EntityManagerInterface $entityManager) + { + } public function __invoke(CalendarRangeMessage $calendarRangeMessage): void { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php index 73e8a0c37..6838d3147 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarRemoveHandler.php @@ -31,7 +31,9 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class CalendarRemoveHandler implements MessageHandlerInterface { - public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly CalendarRangeRepository $calendarRangeRepository, private readonly UserRepositoryInterface $userRepository) {} + public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly CalendarRangeRepository $calendarRangeRepository, private readonly UserRepositoryInterface $userRepository) + { + } public function __invoke(CalendarRemovedMessage $message) { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php index 6a1388d2e..310e8734b 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/CalendarToRemoteHandler.php @@ -37,7 +37,9 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class CalendarToRemoteHandler implements MessageHandlerInterface { - public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly CalendarRepository $calendarRepository, private readonly EntityManagerInterface $entityManager, private readonly InviteRepository $inviteRepository, private readonly RemoteCalendarConnectorInterface $calendarConnector, private readonly UserRepository $userRepository) {} + public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly CalendarRepository $calendarRepository, private readonly EntityManagerInterface $entityManager, private readonly InviteRepository $inviteRepository, private readonly RemoteCalendarConnectorInterface $calendarConnector, private readonly UserRepository $userRepository) + { + } public function __invoke(CalendarMessage $calendarMessage) { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php index 7ca5f2c12..1d987c19e 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/InviteUpdateHandler.php @@ -31,7 +31,9 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class InviteUpdateHandler implements MessageHandlerInterface { - public function __construct(private readonly EntityManagerInterface $em, private readonly InviteRepository $inviteRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector) {} + public function __construct(private readonly EntityManagerInterface $em, private readonly InviteRepository $inviteRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector) + { + } public function __invoke(InviteUpdateMessage $inviteUpdateMessage): void { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php index 7a67bee61..26908a6e4 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php @@ -36,7 +36,9 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class MSGraphChangeNotificationHandler implements MessageHandlerInterface { - public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly CalendarRangeSyncer $calendarRangeSyncer, private readonly CalendarRepository $calendarRepository, private readonly CalendarSyncer $calendarSyncer, private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly MapCalendarToUser $mapCalendarToUser, private readonly UserRepository $userRepository) {} + public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly CalendarRangeSyncer $calendarRangeSyncer, private readonly CalendarRepository $calendarRepository, private readonly CalendarSyncer $calendarSyncer, private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly MapCalendarToUser $mapCalendarToUser, private readonly UserRepository $userRepository) + { + } public function __invoke(MSGraphChangeNotificationMessage $changeNotificationMessage): void { diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Message/MSGraphChangeNotificationMessage.php b/src/Bundle/ChillCalendarBundle/Messenger/Message/MSGraphChangeNotificationMessage.php index 15b8c6733..682369e03 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Message/MSGraphChangeNotificationMessage.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Message/MSGraphChangeNotificationMessage.php @@ -20,7 +20,9 @@ namespace Chill\CalendarBundle\Messenger\Message; class MSGraphChangeNotificationMessage { - public function __construct(private readonly array $content, private readonly int $userId) {} + public function __construct(private readonly array $content, private readonly int $userId) + { + } public function getContent(): array { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/AddressConverter.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/AddressConverter.php index 2535e23ca..2764a46e3 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/AddressConverter.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/AddressConverter.php @@ -24,7 +24,9 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface; class AddressConverter { - public function __construct(private readonly AddressRender $addressRender, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} + public function __construct(private readonly AddressRender $addressRender, private readonly TranslatableStringHelperInterface $translatableStringHelper) + { + } public function addressToRemote(Address $address): array { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/EventsOnUserSubscriptionCreator.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/EventsOnUserSubscriptionCreator.php index 080140d86..f3d764acc 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/EventsOnUserSubscriptionCreator.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/EventsOnUserSubscriptionCreator.php @@ -28,7 +28,9 @@ use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; */ class EventsOnUserSubscriptionCreator { - public function __construct(private readonly LoggerInterface $logger, private readonly MachineHttpClient $machineHttpClient, private readonly MapCalendarToUser $mapCalendarToUser, private readonly UrlGeneratorInterface $urlGenerator) {} + public function __construct(private readonly LoggerInterface $logger, private readonly MachineHttpClient $machineHttpClient, private readonly MapCalendarToUser $mapCalendarToUser, private readonly UrlGeneratorInterface $urlGenerator) + { + } /** * @return array{secret: string, id: string, expiration: int} diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/LocationConverter.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/LocationConverter.php index f14683b9e..cbf97806e 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/LocationConverter.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/LocationConverter.php @@ -22,7 +22,9 @@ use Chill\MainBundle\Entity\Location; class LocationConverter { - public function __construct(private readonly AddressConverter $addressConverter) {} + public function __construct(private readonly AddressConverter $addressConverter) + { + } public function locationToRemote(Location $location): array { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReader.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReader.php index 37e3e1996..2d1006cca 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReader.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceReader.php @@ -27,7 +27,8 @@ final readonly class MSUserAbsenceReader implements MSUserAbsenceReaderInterface private HttpClientInterface $machineHttpClient, private MapCalendarToUser $mapCalendarToUser, private ClockInterface $clock, - ) {} + ) { + } /** * @throw UserAbsenceSyncException when the data cannot be reached or is not valid from microsoft diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceSync.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceSync.php index 318580ffc..1d7b181f3 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceSync.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSUserAbsenceSync.php @@ -21,7 +21,8 @@ readonly class MSUserAbsenceSync private MSUserAbsenceReaderInterface $absenceReader, private ClockInterface $clock, private LoggerInterface $logger, - ) {} + ) { + } public function syncUserAbsence(User $user): void { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineTokenStorage.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineTokenStorage.php index f2a0fc096..f5d25caaf 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineTokenStorage.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MachineTokenStorage.php @@ -29,7 +29,9 @@ class MachineTokenStorage private ?AccessTokenInterface $accessToken = null; - public function __construct(private readonly Azure $azure, private readonly ChillRedis $chillRedis) {} + public function __construct(private readonly Azure $azure, private readonly ChillRedis $chillRedis) + { + } public function getToken(): AccessTokenInterface { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php index 4b214e6d0..70a0fae55 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php @@ -36,7 +36,9 @@ class MapCalendarToUser final public const SECRET_SUBSCRIPTION_EVENT = 'subscription_events_secret'; - public function __construct(private readonly HttpClientInterface $machineHttpClient, private readonly LoggerInterface $logger) {} + public function __construct(private readonly HttpClientInterface $machineHttpClient, private readonly LoggerInterface $logger) + { + } public function getActiveSubscriptionId(User $user): string { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserTokenStorage.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserTokenStorage.php index d8fff109b..cc5b72b42 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserTokenStorage.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/OnBehalfOfUserTokenStorage.php @@ -29,7 +29,9 @@ class OnBehalfOfUserTokenStorage { final public const MS_GRAPH_ACCESS_TOKEN = 'msgraph_access_token'; - public function __construct(private readonly Azure $azure, private readonly SessionInterface $session) {} + public function __construct(private readonly Azure $azure, private readonly SessionInterface $session) + { + } public function getToken(): AccessToken { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php index 1dffe198c..0c9621aeb 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php @@ -32,7 +32,9 @@ class CalendarRangeSyncer /** * @param MachineHttpClient $machineHttpClient */ - public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly HttpClientInterface $machineHttpClient) {} + public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly HttpClientInterface $machineHttpClient) + { + } public function handleCalendarRangeSync(CalendarRange $calendarRange, array $notification, User $user): void { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php index 9b4daf626..06e0f2b39 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php @@ -29,7 +29,9 @@ use Symfony\Contracts\HttpClient\HttpClientInterface; class CalendarSyncer { - public function __construct(private readonly LoggerInterface $logger, private readonly HttpClientInterface $machineHttpClient, private readonly UserRepositoryInterface $userRepository) {} + public function __construct(private readonly LoggerInterface $logger, private readonly HttpClientInterface $machineHttpClient, private readonly UserRepositoryInterface $userRepository) + { + } public function handleCalendarSync(Calendar $calendar, array $notification, User $user): void { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php index 768ad2a44..23f83688a 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php @@ -41,7 +41,9 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface { private array $cacheScheduleTimeForUser = []; - public function __construct(private readonly CalendarRepository $calendarRepository, private readonly CalendarRangeRepository $calendarRangeRepository, private readonly HttpClientInterface $machineHttpClient, private readonly MapCalendarToUser $mapCalendarToUser, private readonly LoggerInterface $logger, private readonly OnBehalfOfUserTokenStorage $tokenStorage, private readonly OnBehalfOfUserHttpClient $userHttpClient, private readonly RemoteEventConverter $remoteEventConverter, private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator, private readonly Security $security) {} + public function __construct(private readonly CalendarRepository $calendarRepository, private readonly CalendarRangeRepository $calendarRangeRepository, private readonly HttpClientInterface $machineHttpClient, private readonly MapCalendarToUser $mapCalendarToUser, private readonly LoggerInterface $logger, private readonly OnBehalfOfUserTokenStorage $tokenStorage, private readonly OnBehalfOfUserHttpClient $userHttpClient, private readonly RemoteEventConverter $remoteEventConverter, private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator, private readonly Security $security) + { + } public function countEventsForUser(User $user, \DateTimeImmutable $startDate, \DateTimeImmutable $endDate): int { diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/NullRemoteCalendarConnector.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/NullRemoteCalendarConnector.php index b4e2a5d3a..4acb40554 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/NullRemoteCalendarConnector.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/NullRemoteCalendarConnector.php @@ -46,13 +46,23 @@ class NullRemoteCalendarConnector implements RemoteCalendarConnectorInterface return []; } - public function removeCalendar(string $remoteId, array $remoteAttributes, User $user, CalendarRange $associatedCalendarRange = null): void {} + public function removeCalendar(string $remoteId, array $remoteAttributes, User $user, CalendarRange $associatedCalendarRange = null): void + { + } - public function removeCalendarRange(string $remoteId, array $remoteAttributes, User $user): void {} + public function removeCalendarRange(string $remoteId, array $remoteAttributes, User $user): void + { + } - public function syncCalendar(Calendar $calendar, string $action, ?CalendarRange $previousCalendarRange, ?User $previousMainUser, ?array $oldInvites, ?array $newInvites): void {} + public function syncCalendar(Calendar $calendar, string $action, ?CalendarRange $previousCalendarRange, ?User $previousMainUser, ?array $oldInvites, ?array $newInvites): void + { + } - public function syncCalendarRange(CalendarRange $calendarRange): void {} + public function syncCalendarRange(CalendarRange $calendarRange): void + { + } - public function syncInvite(Invite $invite): void {} + public function syncInvite(Invite $invite): void + { + } } diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php index 40d1d1435..0c87ae4eb 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php @@ -44,5 +44,6 @@ class RemoteEvent * @Serializer\Groups({"read"}) */ public bool $isAllDay = false - ) {} + ) { + } } diff --git a/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php b/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php index 8f490f376..c91794c6b 100644 --- a/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php +++ b/src/Bundle/ChillCalendarBundle/Repository/CalendarACLAwareRepository.php @@ -28,7 +28,9 @@ use Doctrine\ORM\QueryBuilder; class CalendarACLAwareRepository implements CalendarACLAwareRepositoryInterface { - public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly EntityManagerInterface $em) {} + public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly EntityManagerInterface $em) + { + } public function buildQueryByAccompanyingPeriod(AccompanyingPeriod $period, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate): QueryBuilder { diff --git a/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarDocVoter.php b/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarDocVoter.php index a0e653cb1..5eaa85871 100644 --- a/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarDocVoter.php +++ b/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarDocVoter.php @@ -27,7 +27,9 @@ class CalendarDocVoter extends Voter 'CHILL_CALENDAR_DOC_SEE', ]; - public function __construct(private readonly Security $security) {} + public function __construct(private readonly Security $security) + { + } protected function supports($attribute, $subject): bool { diff --git a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php index 087f5ea86..27cfb05e6 100644 --- a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php +++ b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php @@ -41,7 +41,8 @@ final readonly class CalendarContext implements CalendarContextInterface private ThirdPartyRender $thirdPartyRender, private ThirdPartyRepository $thirdPartyRepository, private TranslatableStringHelperInterface $translatableStringHelper - ) {} + ) { + } public function adminFormReverseTransform(array $data): array { diff --git a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContextInterface.php b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContextInterface.php index 09a333f3f..917a0b5fa 100644 --- a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContextInterface.php +++ b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContextInterface.php @@ -19,4 +19,6 @@ use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithPublicFormInterface; * @extends DocGeneratorContextWithPublicFormInterface * @extends DocGeneratorContextWithAdminFormInterface */ -interface CalendarContextInterface extends DocGeneratorContextWithPublicFormInterface, DocGeneratorContextWithAdminFormInterface {} +interface CalendarContextInterface extends DocGeneratorContextWithPublicFormInterface, DocGeneratorContextWithAdminFormInterface +{ +} diff --git a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php index 5e4e7de83..7b566a2f1 100644 --- a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php +++ b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php @@ -38,7 +38,8 @@ final readonly class AccompanyingPeriodCalendarGenericDocProvider implements Gen public function __construct( private Security $security, private EntityManagerInterface $em - ) {} + ) { + } /** * @throws MappingException diff --git a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/PersonCalendarGenericDocProvider.php b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/PersonCalendarGenericDocProvider.php index 49e890ca0..7b7a8f96d 100644 --- a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/PersonCalendarGenericDocProvider.php +++ b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/PersonCalendarGenericDocProvider.php @@ -37,7 +37,8 @@ final readonly class PersonCalendarGenericDocProvider implements GenericDocForPe public function __construct( private Security $security, private EntityManagerInterface $em - ) {} + ) { + } private function addWhereClausesToQuery(FetchQuery $query, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): FetchQuery { diff --git a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Renderers/AccompanyingPeriodCalendarGenericDocRenderer.php b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Renderers/AccompanyingPeriodCalendarGenericDocRenderer.php index 123afc164..1f4c3a45f 100644 --- a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Renderers/AccompanyingPeriodCalendarGenericDocRenderer.php +++ b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Renderers/AccompanyingPeriodCalendarGenericDocRenderer.php @@ -19,7 +19,9 @@ use Chill\DocStoreBundle\GenericDoc\Twig\GenericDocRendererInterface; final readonly class AccompanyingPeriodCalendarGenericDocRenderer implements GenericDocRendererInterface { - public function __construct(private CalendarDocRepository $repository) {} + public function __construct(private CalendarDocRepository $repository) + { + } public function supports(GenericDocDTO $genericDocDTO, $options = []): bool { diff --git a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php index 9a4a92a94..b03a023d8 100644 --- a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php +++ b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php @@ -25,7 +25,9 @@ use Symfony\Component\Messenger\MessageBusInterface; class BulkCalendarShortMessageSender { - public function __construct(private readonly CalendarForShortMessageProvider $provider, private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly MessageBusInterface $messageBus, private readonly ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder) {} + public function __construct(private readonly CalendarForShortMessageProvider $provider, private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly MessageBusInterface $messageBus, private readonly ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder) + { + } public function sendBulkMessageToEligibleCalendars() { diff --git a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/CalendarForShortMessageProvider.php b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/CalendarForShortMessageProvider.php index 31b870ed4..85bc74efc 100644 --- a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/CalendarForShortMessageProvider.php +++ b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/CalendarForShortMessageProvider.php @@ -24,7 +24,9 @@ use Doctrine\ORM\EntityManagerInterface; class CalendarForShortMessageProvider { - public function __construct(private readonly CalendarRepository $calendarRepository, private readonly EntityManagerInterface $em, private readonly RangeGeneratorInterface $rangeGenerator) {} + public function __construct(private readonly CalendarRepository $calendarRepository, private readonly EntityManagerInterface $em, private readonly RangeGeneratorInterface $rangeGenerator) + { + } /** * Generate calendars instance. diff --git a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php index 880c9950f..6c402ffe3 100644 --- a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/DefaultShortMessageForCalendarBuilder.php @@ -23,7 +23,9 @@ use Chill\MainBundle\Service\ShortMessage\ShortMessage; class DefaultShortMessageForCalendarBuilder implements ShortMessageForCalendarBuilderInterface { - public function __construct(private readonly \Twig\Environment $engine) {} + public function __construct(private readonly \Twig\Environment $engine) + { + } public function buildMessageForCalendar(Calendar $calendar): array { diff --git a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php index 08425bcf0..de3f0cf5b 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php +++ b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php @@ -86,7 +86,7 @@ class CreateFieldsOnGroupCommand extends Command $em = $this->entityManager; $customFieldsGroups = $em - ->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class) + ->getRepository(CustomFieldsGroup::class) ->findAll(); if (0 === \count($customFieldsGroups)) { diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php index f96c25909..0e0c23ab4 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php @@ -25,12 +25,14 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class CustomFieldController extends AbstractController { - public function __construct(private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatorInterface $translator) + { + } /** * Creates a new CustomField entity. * - * @Route("/{_locale}/admin/customfield/new", name="customfield_new") + * @Route("/{_locale}/admin/customfield/new", name="customfield_create") */ public function createAction(Request $request) { @@ -121,7 +123,7 @@ class CustomFieldController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomField::class)->find($id); + $entity = $em->getRepository(CustomField::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find CustomField entity.'); diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php index 829ca5c55..b88a005dc 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php @@ -36,7 +36,9 @@ class CustomFieldsGroupController extends AbstractController /** * CustomFieldsGroupController constructor. */ - public function __construct(private readonly CustomFieldProvider $customFieldProvider, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly CustomFieldProvider $customFieldProvider, private readonly TranslatorInterface $translator) + { + } /** * Creates a new CustomFieldsGroup entity. @@ -78,7 +80,7 @@ class CustomFieldsGroupController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)->find($id); + $entity = $em->getRepository(CustomFieldsGroup::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.'); @@ -101,7 +103,7 @@ class CustomFieldsGroupController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $cfGroups = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)->findAll(); + $cfGroups = $em->getRepository(CustomFieldsGroup::class)->findAll(); $defaultGroups = $this->getDefaultGroupsId(); $makeDefaultFormViews = []; @@ -133,13 +135,13 @@ class CustomFieldsGroupController extends AbstractController $em = $this->getDoctrine()->getManager(); - $cFGroup = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)->findOneById($cFGroupId); + $cFGroup = $em->getRepository(CustomFieldsGroup::class)->findOneById($cFGroupId); if (!$cFGroup) { throw $this->createNotFoundException('customFieldsGroup not found with '."id {$cFGroupId}"); } - $cFDefaultGroup = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsDefaultGroup::class) + $cFDefaultGroup = $em->getRepository(CustomFieldsDefaultGroup::class) ->findOneByEntity($cFGroup->getEntity()); if ($cFDefaultGroup) { @@ -194,7 +196,7 @@ class CustomFieldsGroupController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)->find($id); + $entity = $em->getRepository(CustomFieldsGroup::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find CustomFieldsGroups entity.'); @@ -232,13 +234,13 @@ class CustomFieldsGroupController extends AbstractController /** * Finds and displays a CustomFieldsGroup entity. * - * @Route("/{_locale}/admin/customfieldsgroup/{id}/show", name="customfieldsgroup/show") + * @Route("/{_locale}/admin/customfieldsgroup/{id}/show", name="customfieldsgroup_show") */ public function showAction(mixed $id) { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)->find($id); + $entity = $em->getRepository(CustomFieldsGroup::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.'); @@ -256,13 +258,13 @@ class CustomFieldsGroupController extends AbstractController /** * Edits an existing CustomFieldsGroup entity. * - * @Route("/{_locale}/admin/customfieldsgroup/{id}/update", name="customfieldsgroup/update") + * @Route("/{_locale}/admin/customfieldsgroup/{id}/update", name="customfieldsgroup_update") */ public function updateAction(Request $request, mixed $id) { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)->find($id); + $entity = $em->getRepository(CustomFieldsGroup::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.'); @@ -383,7 +385,7 @@ class CustomFieldsGroupController extends AbstractController $em = $this->getDoctrine()->getManager(); $customFieldsGroupIds = $em->createQuery('SELECT g.id FROM ' - .'ChillCustomFieldsBundle:CustomFieldsDefaultGroup d ' + .CustomFieldsDefaultGroup::class.' d ' .'JOIN d.customFieldsGroup g') ->getResult(Query::HYDRATE_SCALAR); diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php index 8fd91f27d..3daee9ecb 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php @@ -43,7 +43,8 @@ class CustomFieldChoice extends AbstractCustomField * @var TranslatableStringHelper Helper that find the string in current locale from an array of translation */ private readonly TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function allowOtherChoice(CustomField $cf) { @@ -280,7 +281,7 @@ class CustomFieldChoice extends AbstractCustomField $template = '@ChillCustomFields/CustomFieldsRendering/choice.html.twig'; if ('csv' === $documentType) { - $template = 'ChillCustomFieldsBundle:CustomFieldsRendering:choice.csv.twig'; + $template = '@ChillCustomFields/CustomFieldsRendering/choice.csv.twig'; } return $this->templating diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php index a535f805e..ecc97fbcc 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php @@ -45,7 +45,8 @@ class CustomFieldDate extends AbstractCustomField public function __construct( private readonly Environment $templating, private readonly TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function buildForm(FormBuilderInterface $builder, CustomField $customField) { @@ -68,7 +69,7 @@ class CustomFieldDate extends AbstractCustomField { $validatorFunction = static function ($value, ExecutionContextInterface $context) { try { - $date = new \DateTime($value); + $date = new \DateTime((string) $value); } catch (\Exception) { $context->buildViolation('The expression "%expression%" is invalid', [ '%expression%' => $value, @@ -125,7 +126,7 @@ class CustomFieldDate extends AbstractCustomField return $date->format('Y-m-d'); default: - $template = 'ChillCustomFieldsBundle:CustomFieldsRendering:date.' + $template = '@ChillCustomFields/CustomFieldsRendering/date.' .$documentType.'.twig'; return $this->templating diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php index 885a02f2d..b524eca5d 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php @@ -28,7 +28,8 @@ class CustomFieldLongChoice extends AbstractCustomField private readonly OptionRepository $optionRepository, private readonly TranslatableStringHelper $translatableStringHelper, private readonly \Twig\Environment $templating, - ) {} + ) { + } public function buildForm(FormBuilderInterface $builder, CustomField $customField) { @@ -96,7 +97,7 @@ class CustomFieldLongChoice extends AbstractCustomField public function render($value, CustomField $customField, $documentType = 'html') { $option = $this->deserialize($value, $customField); - $template = 'ChillCustomFieldsBundle:CustomFieldsRendering:choice_long.' + $template = '@ChillCustomFields/CustomFieldsRendering/choice_long.' .$documentType.'.twig'; return $this->templating diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php index 979d96540..27dfce42c 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php @@ -42,7 +42,8 @@ class CustomFieldNumber extends AbstractCustomField public function __construct( private readonly Environment $templating, private readonly TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function buildForm(FormBuilderInterface $builder, CustomField $customField) { @@ -95,7 +96,7 @@ class CustomFieldNumber extends AbstractCustomField public function render($value, CustomField $customField, $documentType = 'html') { - $template = 'ChillCustomFieldsBundle:CustomFieldsRendering:number.' + $template = '@ChillCustomFields/CustomFieldsRendering/number.' .$documentType.'.twig'; $options = $customField->getOptions(); diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php index f95048e21..6e9a3df0e 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php @@ -29,7 +29,8 @@ class CustomFieldText extends AbstractCustomField public function __construct( private readonly Environment $templating, private readonly TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } /** * Create a form according to the maxLength option. @@ -89,7 +90,7 @@ class CustomFieldText extends AbstractCustomField $template = '@ChillCustomFields/CustomFieldsRendering/text.html.twig'; if ('csv' === $documentType) { - $template = 'ChillCustomFieldsBundle:CustomFieldsRendering:text.csv.twig'; + $template = '@ChillCustomFields/CustomFieldsRendering/text.csv.twig'; } return $this->templating diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php index 302e04350..07a0a0121 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php @@ -32,7 +32,8 @@ class CustomFieldTitle extends AbstractCustomField * @var TranslatableStringHelper Helper that find the string in current locale from an array of translation */ private readonly TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function buildForm(FormBuilderInterface $builder, CustomField $customField) { diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php index 9ffc157cc..f7ffdc465 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\CustomFieldsBundle\Form; +use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup; use Chill\CustomFieldsBundle\Form\DataTransformer\CustomFieldsGroupToIdTransformer; use Chill\CustomFieldsBundle\Service\CustomFieldProvider; use Chill\MainBundle\Form\Type\TranslatableStringFormType; @@ -29,7 +30,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class CustomFieldType extends AbstractType { - public function __construct(private readonly CustomFieldProvider $customFieldProvider, private readonly ObjectManager $om, private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly CustomFieldProvider $customFieldProvider, private readonly ObjectManager $om, private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { @@ -45,7 +48,7 @@ class CustomFieldType extends AbstractType if ('entity' === $options['group_widget']) { $builder->add('customFieldsGroup', EntityType::class, [ - 'class' => 'ChillCustomFieldsBundle:CustomFieldsGroup', + 'class' => CustomFieldsGroup::class, 'choice_label' => fn ($g) => $this->translatableStringHelper->localize($g->getName()), ]); } elseif ('hidden' === $options['group_widget']) { diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php index 8cf3ea182..5bb16c80d 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php @@ -27,7 +27,8 @@ class CustomFieldsGroupType extends AbstractType private readonly array $customizableEntities, // TODO : add comment about this variable private readonly TranslatorInterface $translator - ) {} + ) { + } // TODO : details about the function public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php index ee5f8b386..3091ea66f 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php @@ -17,7 +17,9 @@ use Symfony\Component\Form\DataTransformerInterface; class CustomFieldDataTransformer implements DataTransformerInterface { - public function __construct(private readonly CustomFieldInterface $customFieldDefinition, private readonly CustomField $customField) {} + public function __construct(private readonly CustomFieldInterface $customFieldDefinition, private readonly CustomField $customField) + { + } public function reverseTransform($value) { diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php index 180ac0a8a..cd33068a9 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php @@ -18,7 +18,9 @@ use Symfony\Component\Form\Exception\TransformationFailedException; class CustomFieldsGroupToIdTransformer implements DataTransformerInterface { - public function __construct(private readonly ObjectManager $om) {} + public function __construct(private readonly ObjectManager $om) + { + } /** * Transforms a string (id) to an object (CustomFieldsGroup). diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldsTitleType.php b/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldsTitleType.php index 5d5377a15..fa462737e 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldsTitleType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldsTitleType.php @@ -16,7 +16,9 @@ use Symfony\Component\Form\FormBuilderInterface; class CustomFieldsTitleType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) {} + public function buildForm(FormBuilderInterface $builder, array $options) + { + } public function getBlockPrefix() { diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php b/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php index 8f6e896bf..25418e5c4 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php @@ -42,7 +42,9 @@ class LinkedCustomFieldsType extends AbstractType */ private array $options = []; - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) + { + } /** * append Choice on POST_SET_DATA event. diff --git a/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php index 320f36544..e684899b4 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php +++ b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php @@ -29,7 +29,9 @@ class CustomFieldsHelper * @param CustomFieldProvider $provider The customfield provider that * contains all the declared custom fields */ - public function __construct(private readonly EntityManagerInterface $em, private readonly CustomFieldProvider $provider) {} + public function __construct(private readonly EntityManagerInterface $em, private readonly CustomFieldProvider $provider) + { + } public function isEmptyValue(array $fields, CustomField $customField) { diff --git a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php index 6d3d889a8..62181de74 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php +++ b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php @@ -31,7 +31,9 @@ class CustomFieldRenderingTwig extends AbstractExtension 'label_layout' => '@ChillCustomFields/CustomField/render_label.html.twig', ]; - public function __construct(private readonly CustomFieldsHelper $customFieldsHelper) {} + public function __construct(private readonly CustomFieldsHelper $customFieldsHelper) + { + } /** * (non-PHPdoc). diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php index 35d9ca3a3..48d4847d6 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php +++ b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php @@ -29,7 +29,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; final class CustomFieldsChoiceTest extends KernelTestCase { /** - * @var \Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice + * @var CustomFieldChoice */ private $cfChoice; diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php index 87722c1bd..2d1268e71 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php +++ b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php @@ -43,7 +43,7 @@ final class CustomFieldsTextTest extends WebTestCase $customField ); $this->assertInstanceOf( - \Chill\CustomFieldsBundle\CustomFields\CustomFieldText::class, + CustomFieldText::class, $customField ); } diff --git a/src/Bundle/ChillCustomFieldsBundle/config/services/controller.yaml b/src/Bundle/ChillCustomFieldsBundle/config/services/controller.yaml index e57828e5f..2a25ea048 100644 --- a/src/Bundle/ChillCustomFieldsBundle/config/services/controller.yaml +++ b/src/Bundle/ChillCustomFieldsBundle/config/services/controller.yaml @@ -1,4 +1,8 @@ services: + _defaults: + autowire: true + autoconfigure: true + Chill\CustomFieldsBundle\Controller\: resource: '../../Controller' tags: ['controller.service_arguments'] diff --git a/src/Bundle/ChillDocGeneratorBundle/Context/ContextManager.php b/src/Bundle/ChillDocGeneratorBundle/Context/ContextManager.php index afcf6fab1..95419e001 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Context/ContextManager.php +++ b/src/Bundle/ChillDocGeneratorBundle/Context/ContextManager.php @@ -19,7 +19,9 @@ final readonly class ContextManager implements ContextManagerInterface /** * @param \Chill\DocGeneratorBundle\Context\DocGeneratorContextInterface[] $contexts */ - public function __construct(private iterable $contexts) {} + public function __construct(private iterable $contexts) + { + } public function getContextByDocGeneratorTemplate(DocGeneratorTemplate $docGeneratorTemplate): DocGeneratorContextInterface { diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php index ecb896080..ebce55957 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php @@ -22,7 +22,9 @@ use Symfony\Component\Routing\Annotation\Route; class AdminDocGeneratorTemplateController extends CRUDController { - public function __construct(private readonly ContextManager $contextManager) {} + public function __construct(private readonly ContextManager $contextManager) + { + } public function generateTemplateParameter(string $action, $entity, Request $request, array $defaultTemplateParameters = []) { diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php index c9e1873b2..788ccb59c 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php @@ -37,7 +37,9 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; final class DocGeneratorTemplateController extends AbstractController { - public function __construct(private readonly ContextManager $contextManager, private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly GeneratorInterface $generator, private readonly MessageBusInterface $messageBus, private readonly PaginatorFactory $paginatorFactory, private readonly EntityManagerInterface $entityManager) {} + public function __construct(private readonly ContextManager $contextManager, private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly GeneratorInterface $generator, private readonly MessageBusInterface $messageBus, private readonly PaginatorFactory $paginatorFactory, private readonly EntityManagerInterface $entityManager) + { + } /** * @Route( diff --git a/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php b/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php index 1b87ef926..8f698cb97 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php +++ b/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php @@ -24,7 +24,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class DocGeneratorTemplateType extends AbstractType { - public function __construct(private readonly ContextManager $contextManager) {} + public function __construct(private readonly ContextManager $contextManager) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php index 8796b8e39..a021e1495 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php @@ -18,7 +18,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AdminMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private readonly TranslatorInterface $translator, private readonly Security $security) {} + public function __construct(private readonly TranslatorInterface $translator, private readonly Security $security) + { + } public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php b/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php index 4614c7850..c7167670d 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php +++ b/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php @@ -11,14 +11,16 @@ declare(strict_types=1); namespace Chill\DocGeneratorBundle\Serializer\Helper; -use Symfony\Component\Serializer\Mapping\ClassMetadata; +use Symfony\Component\Serializer\Mapping\ClassMetadataInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class NormalizeNullValueHelper { - public function __construct(private readonly NormalizerInterface $normalizer, private readonly ?string $discriminatorType = null, private readonly ?string $discriminatorValue = null) {} + public function __construct(private readonly NormalizerInterface $normalizer, private readonly ?string $discriminatorType = null, private readonly ?string $discriminatorValue = null) + { + } - public function normalize(array $attributes, string $format = 'docgen', ?array $context = [], ClassMetadata $classMetadata = null) + public function normalize(array $attributes, string $format = 'docgen', ?array $context = [], ClassMetadataInterface $classMetadata = null) { $data = []; $data['isNull'] = true; @@ -44,7 +46,7 @@ class NormalizeNullValueHelper return $data; } - private function getContextForAttribute(string $key, array $initialContext, ?ClassMetadata $classMetadata): array + private function getContextForAttribute(string $key, array $initialContext, ?ClassMetadataInterface $classMetadata): array { if (null === $classMetadata) { return $initialContext; diff --git a/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php b/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php index a748c4e22..a19e783d1 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php +++ b/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php @@ -19,6 +19,7 @@ use Symfony\Component\PropertyAccess\PropertyAccessor; use Symfony\Component\Serializer\Exception\ExceptionInterface; use Symfony\Component\Serializer\Exception\LogicException; use Symfony\Component\Serializer\Mapping\AttributeMetadata; +use Symfony\Component\Serializer\Mapping\AttributeMetadataInterface; use Symfony\Component\Serializer\Mapping\ClassMetadata; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface; use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; @@ -52,12 +53,15 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte } $metadata = $this->classMetadataFactory->getMetadataFor($classMetadataKey); + if (!$metadata instanceof ClassMetadata) { + throw new \LogicException('ClassMetadata should be the only one implementation for ClassMetadataInterface. See https://github.com/symfony/symfony/pull/17114'); + } $expectedGroups = \array_key_exists(AbstractNormalizer::GROUPS, $context) ? \is_array($context[AbstractNormalizer::GROUPS]) ? $context[AbstractNormalizer::GROUPS] : [$context[AbstractNormalizer::GROUPS]] : []; $attributes = \array_filter( $metadata->getAttributesMetadata(), - static function (AttributeMetadata $a) use ($expectedGroups) { + static function (AttributeMetadataInterface $a) use ($expectedGroups) { foreach ($a->getGroups() as $g) { if (\in_array($g, $expectedGroups, true)) { return true; @@ -119,7 +123,7 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte return $type->getName(); } if ($type instanceof \ReflectionIntersectionType) { - foreach (array_map(fn (\ReflectionNamedType $t) => $t->getName(), $type->getTypes()) as $classString) { + foreach (array_map(fn (\ReflectionType $t) => $t->getName(), $type->getTypes()) as $classString) { if (ReadableCollection::class === $classString) { return ReadableCollection::class; } @@ -211,7 +215,7 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte } /** - * @param array|AttributeMetadata[] $attributes + * @param array $attributes * * @return array * diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php b/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php index 1eada4e52..28092331f 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php @@ -17,7 +17,9 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class BaseContextData { - public function __construct(private readonly NormalizerInterface $normalizer) {} + public function __construct(private readonly NormalizerInterface $normalizer) + { + } public function getData(User $user = null): array { diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php index 4918223f5..25b5f9f03 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php @@ -27,7 +27,9 @@ class Generator implements GeneratorInterface { private const LOG_PREFIX = '[docgen generator] '; - public function __construct(private readonly ContextManagerInterface $contextManager, private readonly DriverInterface $driver, private readonly EntityManagerInterface $entityManager, private readonly LoggerInterface $logger, private readonly StoredObjectManagerInterface $storedObjectManager) {} + public function __construct(private readonly ContextManagerInterface $contextManager, private readonly DriverInterface $driver, private readonly EntityManagerInterface $entityManager, private readonly LoggerInterface $logger, private readonly StoredObjectManagerInterface $storedObjectManager) + { + } /** * @template T of File|null diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php index 54889f518..57006cb9d 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/OnGenerationFails.php @@ -28,7 +28,9 @@ final readonly class OnGenerationFails implements EventSubscriberInterface { public const LOG_PREFIX = '[docgen failed] '; - public function __construct(private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private EntityManagerInterface $entityManager, private LoggerInterface $logger, private MailerInterface $mailer, private StoredObjectRepository $storedObjectRepository, private TranslatorInterface $translator, private UserRepositoryInterface $userRepository) {} + public function __construct(private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private EntityManagerInterface $entityManager, private LoggerInterface $logger, private MailerInterface $mailer, private StoredObjectRepository $storedObjectRepository, private TranslatorInterface $translator, private UserRepositoryInterface $userRepository) + { + } public static function getSubscribedEvents() { @@ -47,7 +49,7 @@ final readonly class OnGenerationFails implements EventSubscriberInterface return; } - /** @var \Chill\DocGeneratorBundle\Service\Messenger\RequestGenerationMessage $message */ + /** @var RequestGenerationMessage $message */ $message = $event->getEnvelope()->getMessage(); $this->logger->error(self::LOG_PREFIX.'Docgen failed', [ diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php index f6723c617..4ec59d9d4 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php @@ -30,7 +30,9 @@ class RequestGenerationHandler implements MessageHandlerInterface private const LOG_PREFIX = '[docgen message handler] '; - public function __construct(private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly EntityManagerInterface $entityManager, private readonly Generator $generator, private readonly LoggerInterface $logger, private readonly StoredObjectRepository $storedObjectRepository, private readonly UserRepositoryInterface $userRepository) {} + public function __construct(private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly EntityManagerInterface $entityManager, private readonly Generator $generator, private readonly LoggerInterface $logger, private readonly StoredObjectRepository $storedObjectRepository, private readonly UserRepositoryInterface $userRepository) + { + } public function __invoke(RequestGenerationMessage $message) { diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php index 44feb5a47..7fe5eca85 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php @@ -37,7 +37,8 @@ class DocumentAccompanyingCourseController extends AbstractController protected TranslatorInterface $translator, protected EventDispatcherInterface $eventDispatcher, protected AuthorizationHelper $authorizationHelper - ) {} + ) { + } /** * @Route("/{id}/delete", name="chill_docstore_accompanying_course_document_delete") diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php index fc58dff18..14b38f5d4 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php @@ -32,7 +32,7 @@ class DocumentCategoryController extends AbstractController { $em = $this->getDoctrine()->getManager(); $documentCategory = $em - ->getRepository(\Chill\DocStoreBundle\Entity\DocumentCategory::class) + ->getRepository(DocumentCategory::class) ->findOneBy( ['bundleId' => $bundleId, 'idInsideBundle' => $idInsideBundle] ); @@ -52,7 +52,7 @@ class DocumentCategoryController extends AbstractController { $em = $this->getDoctrine()->getManager(); $documentCategory = $em - ->getRepository(\Chill\DocStoreBundle\Entity\DocumentCategory::class) + ->getRepository(DocumentCategory::class) ->findOneBy( ['bundleId' => $bundleId, 'idInsideBundle' => $idInsideBundle] ); @@ -135,7 +135,7 @@ class DocumentCategoryController extends AbstractController { $em = $this->getDoctrine()->getManager(); $documentCategory = $em - ->getRepository(\Chill\DocStoreBundle\Entity\DocumentCategory::class) + ->getRepository(DocumentCategory::class) ->findOneBy( ['bundleId' => $bundleId, 'idInsideBundle' => $idInsideBundle] ); diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php index 73fffa1c4..0f2e9caee 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php @@ -43,7 +43,8 @@ class DocumentPersonController extends AbstractController protected TranslatorInterface $translator, protected EventDispatcherInterface $eventDispatcher, protected AuthorizationHelper $authorizationHelper - ) {} + ) { + } /** * @Route("/{id}/delete", name="chill_docstore_person_document_delete") diff --git a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php index e615c3b00..43a3eca2c 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php @@ -29,7 +29,8 @@ final readonly class GenericDocForAccompanyingPeriodController private PaginatorFactory $paginator, private Security $security, private \Twig\Environment $twig, - ) {} + ) { + } /** * @throws \Doctrine\DBAL\Exception diff --git a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php index f6fecae04..d0d034c7e 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php @@ -29,7 +29,8 @@ final readonly class GenericDocForPerson private PaginatorFactory $paginator, private Security $security, private \Twig\Environment $twig, - ) {} + ) { + } /** * @throws \Doctrine\DBAL\Exception diff --git a/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php b/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php index 5a4b90474..6bfb05bfc 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php @@ -20,7 +20,9 @@ use Symfony\Component\Security\Core\Security; class StoredObjectApiController { - public function __construct(private readonly Security $security) {} + public function __construct(private readonly Security $security) + { + } /** * @Route("/api/1.0/doc-store/stored-object/{uuid}/is-ready") diff --git a/src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php b/src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php index a6c19584d..b7e056cac 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php @@ -53,7 +53,8 @@ class DocumentCategory * @var int The id which is unique inside the bundle */ private $idInsideBundle - ) {} + ) { + } public function getBundleId() // ::class BundleClass (FQDN) { diff --git a/src/Bundle/ChillDocStoreBundle/Entity/PersonDocument.php b/src/Bundle/ChillDocStoreBundle/Entity/PersonDocument.php index 659395034..40b1a73b8 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/PersonDocument.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/PersonDocument.php @@ -41,7 +41,7 @@ class PersonDocument extends Document implements HasCenterInterface, HasScopeInt /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope") * - * @var \Chill\MainBundle\Entity\Scope The document's center + * @var Scope The document's center */ private ?\Chill\MainBundle\Entity\Scope $scope = null; diff --git a/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php b/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php index 0addd53cc..5c0b7d501 100644 --- a/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php +++ b/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php @@ -30,7 +30,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PersonDocumentType extends AbstractType { - public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly ScopeResolverDispatcher $scopeResolverDispatcher, private readonly ParameterBagInterface $parameterBag, private readonly CenterResolverDispatcher $centerResolverDispatcher) {} + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly ScopeResolverDispatcher $scopeResolverDispatcher, private readonly ParameterBagInterface $parameterBag, private readonly CenterResolverDispatcher $centerResolverDispatcher) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/FetchQuery.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/FetchQuery.php index 80eeaf372..8adf13b42 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/FetchQuery.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/FetchQuery.php @@ -54,7 +54,8 @@ class FetchQuery implements FetchQueryInterface private array $selectIdentifierTypes = [], private array $selectDateParams = [], private array $selectDateTypes = [], - ) {} + ) { + } public function addJoinClause(string $sql, array $params = [], array $types = []): int { diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocDTO.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocDTO.php index 7307f0d6a..fe9bf7e4f 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocDTO.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocDTO.php @@ -21,7 +21,8 @@ final readonly class GenericDocDTO public array $identifiers, public \DateTimeImmutable $docDate, public AccompanyingPeriod|Person $linked, - ) {} + ) { + } public function getContext(): string { diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProvider.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProvider.php index 40130e3cc..3ef5d5482 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProvider.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/AccompanyingCourseDocumentGenericDocProvider.php @@ -31,7 +31,8 @@ final readonly class AccompanyingCourseDocumentGenericDocProvider implements Gen public function __construct( private Security $security, private EntityManagerInterface $entityManager, - ) {} + ) { + } public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, \DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null, string $origin = null): FetchQueryInterface { diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/PersonDocumentGenericDocProvider.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/PersonDocumentGenericDocProvider.php index 5f4728297..3345b1c7e 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/PersonDocumentGenericDocProvider.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/Providers/PersonDocumentGenericDocProvider.php @@ -27,7 +27,8 @@ final readonly class PersonDocumentGenericDocProvider implements GenericDocForPe public function __construct( private Security $security, private PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository, - ) {} + ) { + } public function buildFetchQueryForPerson( Person $person, diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/Renderer/AccompanyingCourseDocumentGenericDocRenderer.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/Renderer/AccompanyingCourseDocumentGenericDocRenderer.php index 70175ee1b..195b621c9 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/Renderer/AccompanyingCourseDocumentGenericDocRenderer.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/Renderer/AccompanyingCourseDocumentGenericDocRenderer.php @@ -23,7 +23,8 @@ final readonly class AccompanyingCourseDocumentGenericDocRenderer implements Gen public function __construct( private AccompanyingCourseDocumentRepository $accompanyingCourseDocumentRepository, private PersonDocumentRepository $personDocumentRepository, - ) {} + ) { + } public function supports(GenericDocDTO $genericDocDTO, $options = []): bool { diff --git a/src/Bundle/ChillDocStoreBundle/GenericDoc/Twig/GenericDocExtensionRuntime.php b/src/Bundle/ChillDocStoreBundle/GenericDoc/Twig/GenericDocExtensionRuntime.php index e64838b41..abbaceffb 100644 --- a/src/Bundle/ChillDocStoreBundle/GenericDoc/Twig/GenericDocExtensionRuntime.php +++ b/src/Bundle/ChillDocStoreBundle/GenericDoc/Twig/GenericDocExtensionRuntime.php @@ -25,7 +25,8 @@ final readonly class GenericDocExtensionRuntime implements RuntimeExtensionInter * @var list */ private iterable $renderers, - ) {} + ) { + } /** * @throws RuntimeError diff --git a/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php b/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php index 485c95078..4848d0a5d 100644 --- a/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php +++ b/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php @@ -20,7 +20,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; final readonly class MenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private Security $security, private TranslatorInterface $translator) {} + public function __construct(private Security $security, private TranslatorInterface $translator) + { + } public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php b/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php index 385e8f398..dacd141f3 100644 --- a/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php +++ b/src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php @@ -34,7 +34,8 @@ final readonly class PersonDocumentACLAwareRepository implements PersonDocumentA private CenterResolverManagerInterface $centerResolverManager, private AuthorizationHelperForCurrentUserInterface $authorizationHelperForCurrentUser, private Security $security, - ) {} + ) { + } public function buildQueryByPerson(Person $person): QueryBuilder { diff --git a/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php b/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php index 2c96f7faa..d149e4e9b 100644 --- a/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php +++ b/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php @@ -20,7 +20,9 @@ class StoredObjectDenormalizer implements DenormalizerInterface { use ObjectToPopulateTrait; - public function __construct(private readonly StoredObjectRepository $storedObjectRepository) {} + public function __construct(private readonly StoredObjectRepository $storedObjectRepository) + { + } public function denormalize($data, $type, $format = null, array $context = []) { diff --git a/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php b/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php index 34df98fa2..b55074627 100644 --- a/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php +++ b/src/Bundle/ChillDocStoreBundle/Service/StoredObjectManager.php @@ -27,7 +27,9 @@ final class StoredObjectManager implements StoredObjectManagerInterface private array $inMemory = []; - public function __construct(private readonly HttpClientInterface $client, private readonly TempUrlGeneratorInterface $tempUrlGenerator) {} + public function __construct(private readonly HttpClientInterface $client, private readonly TempUrlGeneratorInterface $tempUrlGenerator) + { + } public function getLastModified(StoredObject $document): \DateTimeInterface { diff --git a/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php b/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php index 5f7a3c7df..969e4f95e 100644 --- a/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php +++ b/src/Bundle/ChillDocStoreBundle/Templating/WopiEditTwigExtensionRuntime.php @@ -120,7 +120,9 @@ final readonly class WopiEditTwigExtensionRuntime implements RuntimeExtensionInt private const TEMPLATE_BUTTON_GROUP = '@ChillDocStore/Button/button_group.html.twig'; - public function __construct(private DiscoveryInterface $discovery, private NormalizerInterface $normalizer) {} + public function __construct(private DiscoveryInterface $discovery, private NormalizerInterface $normalizer) + { + } /** * return true if the document is editable. diff --git a/src/Bundle/ChillEventBundle/ChillEventBundle.php b/src/Bundle/ChillEventBundle/ChillEventBundle.php index 9754f397f..d5a1b43cf 100644 --- a/src/Bundle/ChillEventBundle/ChillEventBundle.php +++ b/src/Bundle/ChillEventBundle/ChillEventBundle.php @@ -13,4 +13,6 @@ namespace Chill\EventBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; -class ChillEventBundle extends Bundle {} +class ChillEventBundle extends Bundle +{ +} diff --git a/src/Bundle/ChillEventBundle/Controller/EventController.php b/src/Bundle/ChillEventBundle/Controller/EventController.php index e6ea264e4..e383c5432 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventController.php @@ -92,7 +92,7 @@ class EventController extends AbstractController public function deleteAction($event_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response { $em = $this->getDoctrine()->getManager(); - $event = $em->getRepository(\Chill\EventBundle\Entity\Event::class)->findOneBy([ + $event = $em->getRepository(Event::class)->findOneBy([ 'id' => $event_id, ]); @@ -146,7 +146,7 @@ class EventController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\EventBundle\Entity\Event::class)->find($event_id); + $entity = $em->getRepository(Event::class)->find($event_id); if (!$entity) { throw $this->createNotFoundException('Unable to find Event entity.'); @@ -173,7 +173,7 @@ class EventController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $person = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($person_id); + $person = $em->getRepository(Person::class)->find($person_id); if (null === $person) { throw $this->createNotFoundException('Person not found'); @@ -187,11 +187,11 @@ class EventController extends AbstractController $person->getCenter() ); - $total = $em->getRepository(\Chill\EventBundle\Entity\Participation::class)->countByPerson($person_id); + $total = $em->getRepository(Participation::class)->countByPerson($person_id); $paginator = $this->paginator->create($total); - $participations = $em->getRepository(\Chill\EventBundle\Entity\Participation::class)->findByPersonInCircle( + $participations = $em->getRepository(Participation::class)->findByPersonInCircle( $person_id, $reachablesCircles, $paginator->getCurrentPage()->getFirstItemNumber(), @@ -352,7 +352,7 @@ class EventController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\EventBundle\Entity\Event::class)->find($event_id); + $entity = $em->getRepository(Event::class)->find($event_id); if (!$entity) { throw $this->createNotFoundException('Unable to find Event entity.'); diff --git a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php index b96fb9cb9..3d9570abb 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php @@ -59,7 +59,7 @@ class EventTypeController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->find($id); + $entity = $em->getRepository(EventType::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find EventType entity.'); @@ -81,7 +81,7 @@ class EventTypeController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->find($id); + $entity = $em->getRepository(EventType::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find EventType entity.'); @@ -106,7 +106,7 @@ class EventTypeController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entities = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->findAll(); + $entities = $em->getRepository(EventType::class)->findAll(); return $this->render('@ChillEvent/EventType/index.html.twig', [ 'entities' => $entities, @@ -138,7 +138,7 @@ class EventTypeController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->find($id); + $entity = $em->getRepository(EventType::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find EventType entity.'); @@ -161,7 +161,7 @@ class EventTypeController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\EventBundle\Entity\EventType::class)->find($id); + $entity = $em->getRepository(EventType::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find EventType entity.'); diff --git a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php index b80e33d2b..b0ce372ff 100644 --- a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php +++ b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php @@ -33,7 +33,9 @@ class ParticipationController extends AbstractController /** * ParticipationController constructor. */ - public function __construct(private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator) + { + } /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/create", name="chill_event_participation_create") @@ -239,7 +241,7 @@ class ParticipationController extends AbstractController public function deleteAction($participation_id, Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse { $em = $this->getDoctrine()->getManager(); - $participation = $em->getRepository(\Chill\EventBundle\Entity\Participation::class)->findOneBy([ + $participation = $em->getRepository(Participation::class)->findOneBy([ 'id' => $participation_id, ]); @@ -319,7 +321,7 @@ class ParticipationController extends AbstractController */ public function editMultipleAction($event_id): Response|\Symfony\Component\HttpFoundation\RedirectResponse { - $event = $this->getDoctrine()->getRepository(\Chill\EventBundle\Entity\Event::class) + $event = $this->getDoctrine()->getRepository(Event::class) ->find($event_id); if (null === $event) { @@ -455,8 +457,8 @@ class ParticipationController extends AbstractController */ public function updateMultipleAction(mixed $event_id, Request $request) { - /** @var \Chill\EventBundle\Entity\Event $event */ - $event = $this->getDoctrine()->getRepository(\Chill\EventBundle\Entity\Event::class) + /** @var Event $event */ + $event = $this->getDoctrine()->getRepository(Event::class) ->find($event_id); if (null === $event) { @@ -498,7 +500,7 @@ class ParticipationController extends AbstractController } /** - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface */ protected function createEditFormMultiple(Collection $participations, Event $event) { @@ -557,7 +559,7 @@ class ParticipationController extends AbstractController // prevent error: `Argument 2 passed to ::getInt() must be of the type int, null given` if (null !== $event_id) { - $event = $em->getRepository(\Chill\EventBundle\Entity\Event::class) + $event = $em->getRepository(Event::class) ->find($event_id); if (null === $event) { @@ -751,7 +753,7 @@ class ParticipationController extends AbstractController } /** - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface */ private function createDeleteForm($participation_id) { diff --git a/src/Bundle/ChillEventBundle/Controller/RoleController.php b/src/Bundle/ChillEventBundle/Controller/RoleController.php index 1b2ad2b25..8c0b63bc8 100644 --- a/src/Bundle/ChillEventBundle/Controller/RoleController.php +++ b/src/Bundle/ChillEventBundle/Controller/RoleController.php @@ -59,7 +59,7 @@ class RoleController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->find($id); + $entity = $em->getRepository(Role::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find Role entity.'); @@ -81,7 +81,7 @@ class RoleController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->find($id); + $entity = $em->getRepository(Role::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find Role entity.'); @@ -106,7 +106,7 @@ class RoleController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entities = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->findAll(); + $entities = $em->getRepository(Role::class)->findAll(); return $this->render('@ChillEvent/Role/index.html.twig', [ 'entities' => $entities, @@ -138,7 +138,7 @@ class RoleController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->find($id); + $entity = $em->getRepository(Role::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find Role entity.'); @@ -161,7 +161,7 @@ class RoleController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\EventBundle\Entity\Role::class)->find($id); + $entity = $em->getRepository(Role::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find Role entity.'); diff --git a/src/Bundle/ChillEventBundle/Controller/StatusController.php b/src/Bundle/ChillEventBundle/Controller/StatusController.php index 90bb7c1f2..c1b1018cd 100644 --- a/src/Bundle/ChillEventBundle/Controller/StatusController.php +++ b/src/Bundle/ChillEventBundle/Controller/StatusController.php @@ -59,7 +59,7 @@ class StatusController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->find($id); + $entity = $em->getRepository(Status::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find Status entity.'); @@ -81,7 +81,7 @@ class StatusController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->find($id); + $entity = $em->getRepository(Status::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find Status entity.'); @@ -106,7 +106,7 @@ class StatusController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entities = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->findAll(); + $entities = $em->getRepository(Status::class)->findAll(); return $this->render('@ChillEvent/Status/index.html.twig', [ 'entities' => $entities, @@ -138,7 +138,7 @@ class StatusController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->find($id); + $entity = $em->getRepository(Status::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find Status entity.'); @@ -161,7 +161,7 @@ class StatusController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository(\Chill\EventBundle\Entity\Status::class)->find($id); + $entity = $em->getRepository(Status::class)->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find Status entity.'); diff --git a/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadParticipation.php b/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadParticipation.php index 71b07a123..db431c858 100644 --- a/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadParticipation.php +++ b/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadParticipation.php @@ -73,7 +73,7 @@ class LoadParticipation extends AbstractFixture implements OrderedFixtureInterfa ->findBy(['center' => $center]); $events = $this->createEvents($center, $manager); - /** @var \Chill\PersonBundle\Entity\Person $person */ + /** @var Person $person */ foreach ($people as $person) { $nb = random_int(0, 3); diff --git a/src/Bundle/ChillEventBundle/Form/ParticipationType.php b/src/Bundle/ChillEventBundle/Form/ParticipationType.php index af1854954..078f2ab9d 100644 --- a/src/Bundle/ChillEventBundle/Form/ParticipationType.php +++ b/src/Bundle/ChillEventBundle/Form/ParticipationType.php @@ -27,7 +27,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; */ final class ParticipationType extends AbstractType { - public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) {} + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillEventBundle/Form/RoleType.php b/src/Bundle/ChillEventBundle/Form/RoleType.php index 8b9f27be2..c8d0f5b33 100644 --- a/src/Bundle/ChillEventBundle/Form/RoleType.php +++ b/src/Bundle/ChillEventBundle/Form/RoleType.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; final class RoleType extends AbstractType { - public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) {} + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php b/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php index 2b85a60c8..487c0c3b2 100644 --- a/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php +++ b/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php @@ -43,7 +43,8 @@ final class PickEventType extends AbstractType private readonly UrlGeneratorInterface $urlGenerator, private readonly TranslatorInterface $translator, private readonly Security $security - ) {} + ) { + } public function buildView(\Symfony\Component\Form\FormView $view, \Symfony\Component\Form\FormInterface $form, array $options) { diff --git a/src/Bundle/ChillEventBundle/Form/Type/PickRoleType.php b/src/Bundle/ChillEventBundle/Form/Type/PickRoleType.php index c8d69c119..8d66963e0 100644 --- a/src/Bundle/ChillEventBundle/Form/Type/PickRoleType.php +++ b/src/Bundle/ChillEventBundle/Form/Type/PickRoleType.php @@ -32,7 +32,8 @@ final class PickRoleType extends AbstractType private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatorInterface $translator, private readonly RoleRepository $roleRepository - ) {} + ) { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillEventBundle/Form/Type/PickStatusType.php b/src/Bundle/ChillEventBundle/Form/Type/PickStatusType.php index 3f4ab3624..be016d6ca 100644 --- a/src/Bundle/ChillEventBundle/Form/Type/PickStatusType.php +++ b/src/Bundle/ChillEventBundle/Form/Type/PickStatusType.php @@ -33,7 +33,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ final class PickStatusType extends AbstractType { - public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected TranslatorInterface $translator, protected StatusRepository $statusRepository) {} + public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected TranslatorInterface $translator, protected StatusRepository $statusRepository) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillEventBundle/Search/EventSearch.php b/src/Bundle/ChillEventBundle/Search/EventSearch.php index 57cb9e9c5..7b77942cd 100644 --- a/src/Bundle/ChillEventBundle/Search/EventSearch.php +++ b/src/Bundle/ChillEventBundle/Search/EventSearch.php @@ -43,7 +43,8 @@ class EventSearch extends AbstractSearch private readonly AuthorizationHelper $authorizationHelper, private readonly \Twig\Environment $templating, private readonly PaginatorFactory $paginatorFactory - ) {} + ) { + } public function getOrder() { diff --git a/src/Bundle/ChillEventBundle/Tests/Search/EventSearchTest.php b/src/Bundle/ChillEventBundle/Tests/Search/EventSearchTest.php index c37566fe7..90c38743b 100644 --- a/src/Bundle/ChillEventBundle/Tests/Search/EventSearchTest.php +++ b/src/Bundle/ChillEventBundle/Tests/Search/EventSearchTest.php @@ -52,7 +52,7 @@ final class EventSearchTest extends WebTestCase /** * The eventSearch service, which is used to search events. * - * @var \Chill\EventBundle\Search\EventSearch + * @var EventSearch */ protected $eventSearch; diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php index cfbe52218..f3982d0d5 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php @@ -141,7 +141,9 @@ abstract class AbstractCRUDController extends AbstractController return new $class(); } - protected function customizeQuery(string $action, Request $request, $query): void {} + protected function customizeQuery(string $action, Request $request, $query): void + { + } protected function getActionConfig(string $action) { diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php index 39cef87b7..78e559ad8 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php @@ -224,9 +224,13 @@ class CRUDController extends AbstractController /** * Customize the form created by createFormFor. */ - protected function customizeForm(string $action, FormInterface $form) {} + protected function customizeForm(string $action, FormInterface $form) + { + } - protected function customizeQuery(string $action, Request $request, $query): void {} + protected function customizeQuery(string $action, Request $request, $query): void + { + } /** * @param null $formClass @@ -840,7 +844,9 @@ class CRUDController extends AbstractController }; } - protected function onFormValid(string $action, object $entity, FormInterface $form, Request $request) {} + protected function onFormValid(string $action, object $entity, FormInterface $form, Request $request) + { + } protected function onPostCheckACL($action, Request $request, $entity): ?Response { @@ -852,36 +858,58 @@ class CRUDController extends AbstractController return null; } - protected function onPostFlush(string $action, $entity, FormInterface $form, Request $request) {} + protected function onPostFlush(string $action, $entity, FormInterface $form, Request $request) + { + } /** * method used by indexAction. */ - protected function onPostIndexBuildQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, mixed $query) {} + protected function onPostIndexBuildQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, mixed $query) + { + } /** * method used by indexAction. */ - protected function onPostIndexFetchQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, mixed $entities) {} + protected function onPostIndexFetchQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, mixed $entities) + { + } - protected function onPostPersist(string $action, $entity, FormInterface $form, Request $request) {} + protected function onPostPersist(string $action, $entity, FormInterface $form, Request $request) + { + } - protected function onPostRemove(string $action, $entity, FormInterface $form, Request $request) {} + protected function onPostRemove(string $action, $entity, FormInterface $form, Request $request) + { + } - protected function onPreDelete(string $action, Request $request) {} + protected function onPreDelete(string $action, Request $request) + { + } - protected function onPreFlush(string $action, $entity, FormInterface $form, Request $request) {} + protected function onPreFlush(string $action, $entity, FormInterface $form, Request $request) + { + } - protected function onPreIndex(string $action, Request $request) {} + protected function onPreIndex(string $action, Request $request) + { + } /** * method used by indexAction. */ - protected function onPreIndexBuildQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator) {} + protected function onPreIndexBuildQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator) + { + } - protected function onPrePersist(string $action, $entity, FormInterface $form, Request $request) {} + protected function onPrePersist(string $action, $entity, FormInterface $form, Request $request) + { + } - protected function onPreRemove(string $action, $entity, FormInterface $form, Request $request) {} + protected function onPreRemove(string $action, $entity, FormInterface $form, Request $request) + { + } /** * Add ordering fields in the query build by self::queryEntities. diff --git a/src/Bundle/ChillMainBundle/CRUD/Form/CRUDDeleteEntityForm.php b/src/Bundle/ChillMainBundle/CRUD/Form/CRUDDeleteEntityForm.php index 95f81ae05..3ff3cf134 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Form/CRUDDeleteEntityForm.php +++ b/src/Bundle/ChillMainBundle/CRUD/Form/CRUDDeleteEntityForm.php @@ -16,4 +16,6 @@ use Symfony\Component\Form\AbstractType; /** * Class CRUDDeleteEntityForm. */ -class CRUDDeleteEntityForm extends AbstractType {} +class CRUDDeleteEntityForm extends AbstractType +{ +} diff --git a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php index e5833e580..860f8c82e 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php @@ -83,7 +83,7 @@ class LoadAndUpdateLanguagesCommand extends Command $languages = []; foreach ($chillAvailableLanguages as $avLang) { - $languages[$avLang] = \Symfony\Component\Intl\Languages::getNames(); + $languages[$avLang] = Languages::getNames(); } foreach (Languages::getNames() as $code => $lang) { @@ -105,7 +105,7 @@ class LoadAndUpdateLanguagesCommand extends Command $languageDB = $em->getRepository(Language::class)->find($code); if (null === $languageDB) { - $languageDB = new \Chill\MainBundle\Entity\Language(); + $languageDB = new Language(); $languageDB->setId($code); $em->persist($languageDB); } diff --git a/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php index 92106d200..b6a9be75c 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php @@ -40,7 +40,7 @@ class LoadCountriesCommand extends Command $names[$language] = Countries::getName($code, $language); } - $country = new \Chill\MainBundle\Entity\Country(); + $country = new Country(); $country->setName($names)->setCountryCode($code); $countryEntities[] = $country; } diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php index b22027499..fe11f8b9f 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php @@ -194,8 +194,14 @@ class LoadPostalCodesCommand extends Command } } -class ExistingPostalCodeException extends \Exception {} +class ExistingPostalCodeException extends \Exception +{ +} -class CountryCodeNotFoundException extends \Exception {} +class CountryCodeNotFoundException extends \Exception +{ +} -class PostalCodeNotValidException extends \Exception {} +class PostalCodeNotValidException extends \Exception +{ +} diff --git a/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php b/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php index c38272d06..a83663ed0 100644 --- a/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php +++ b/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php @@ -36,7 +36,7 @@ class SetPasswordCommand extends Command public function _getUser($username) { return $this->entityManager - ->getRepository(\Chill\MainBundle\Entity\User::class) + ->getRepository(User::class) ->findOneBy(['username' => $username]); } diff --git a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php index b3cf68849..edc58bed5 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php @@ -26,7 +26,9 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; final class AddressReferenceAPIController extends ApiController { - public function __construct(private readonly AddressReferenceRepository $addressReferenceRepository, private readonly PaginatorFactory $paginatorFactory) {} + public function __construct(private readonly AddressReferenceRepository $addressReferenceRepository, private readonly PaginatorFactory $paginatorFactory) + { + } /** * @Route("/api/1.0/main/address-reference/by-postal-code/{id}/search.json") diff --git a/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php b/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php index 967ee7b5b..079f4783b 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php @@ -23,7 +23,9 @@ use Symfony\Component\Serializer\SerializerInterface; class AddressToReferenceMatcherController { - public function __construct(private readonly Security $security, private readonly EntityManagerInterface $entityManager, private readonly SerializerInterface $serializer) {} + public function __construct(private readonly Security $security, private readonly EntityManagerInterface $entityManager, private readonly SerializerInterface $serializer) + { + } /** * @Route("/api/1.0/main/address/reference-match/{id}/set/reviewed", methods={"POST"}) diff --git a/src/Bundle/ChillMainBundle/Controller/ExportController.php b/src/Bundle/ChillMainBundle/Controller/ExportController.php index 190d5f1bf..963e03322 100644 --- a/src/Bundle/ChillMainBundle/Controller/ExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/ExportController.php @@ -70,7 +70,7 @@ class ExportController extends AbstractController */ public function downloadResultAction(Request $request, mixed $alias) { - /** @var \Chill\MainBundle\Export\ExportManager $exportManager */ + /** @var ExportManager $exportManager */ $exportManager = $this->exportManager; $export = $exportManager->getExport($alias); $key = $request->query->get('key', null); @@ -108,13 +108,13 @@ class ExportController extends AbstractController * * @param string $alias * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/generate/{alias}", name="chill_main_export_generate", methods={"GET"}) */ public function generateAction(Request $request, $alias) { - /** @var \Chill\MainBundle\Export\ExportManager $exportManager */ + /** @var ExportManager $exportManager */ $exportManager = $this->exportManager; $key = $request->query->get('key', null); $savedExport = $this->getSavedExportFromRequest($request); @@ -274,7 +274,7 @@ class ExportController extends AbstractController */ protected function createCreateFormExport(string $alias, string $step, array $data, ?SavedExport $savedExport): FormInterface { - /** @var \Chill\MainBundle\Export\ExportManager $exportManager */ + /** @var ExportManager $exportManager */ $exportManager = $this->exportManager; $isGenerate = str_starts_with($step, 'generate_'); @@ -304,7 +304,7 @@ class ExportController extends AbstractController FormType::class, $defaultFormData, [ - 'method' => $isGenerate ? 'GET' : 'POST', + 'method' => $isGenerate ? Request::METHOD_GET : Request::METHOD_POST, 'csrf_protection' => !$isGenerate, ] ); @@ -352,7 +352,7 @@ class ExportController extends AbstractController $form = $this->createCreateFormExport($alias, 'export', $data, $savedExport); - if ('POST' === $request->getMethod()) { + if (Request::METHOD_POST === $request->getMethod()) { $form->handleRequest($request); if ($form->isValid()) { @@ -406,7 +406,7 @@ class ExportController extends AbstractController $form = $this->createCreateFormExport($alias, 'formatter', $data, $savedExport); - if ('POST' === $request->getMethod()) { + if (Request::METHOD_POST === $request->getMethod()) { $form->handleRequest($request); if ($form->isValid()) { @@ -444,7 +444,7 @@ class ExportController extends AbstractController * * @param string $alias * - * @return \Symfony\Component\HttpFoundation\RedirectResponse + * @return RedirectResponse */ private function forwardToGenerate(Request $request, DirectExportInterface|ExportInterface $export, $alias, ?SavedExport $savedExport) { @@ -452,7 +452,7 @@ class ExportController extends AbstractController $dataFormatter = $this->session->get('formatter_step_raw', null); $dataExport = $this->session->get('export_step_raw', null); - if (null === $dataFormatter && $export instanceof \Chill\MainBundle\Export\ExportInterface) { + if (null === $dataFormatter && $export instanceof ExportInterface) { return $this->redirectToRoute('chill_main_export_new', [ 'alias' => $alias, 'step' => $this->getNextStep('generate', $export, true), @@ -531,12 +531,12 @@ class ExportController extends AbstractController ]); } - /** @var \Chill\MainBundle\Export\ExportManager $exportManager */ + /** @var ExportManager $exportManager */ $exportManager = $this->exportManager; $form = $this->createCreateFormExport($alias, 'centers', [], $savedExport); - if ('POST' === $request->getMethod()) { + if (Request::METHOD_POST === $request->getMethod()) { $form->handleRequest($request); if ($form->isValid()) { @@ -620,11 +620,11 @@ class ExportController extends AbstractController return 'export'; case 'export': - if ($export instanceof \Chill\MainBundle\Export\ExportInterface) { + if ($export instanceof ExportInterface) { return $reverse ? 'centers' : 'formatter'; } - if ($export instanceof \Chill\MainBundle\Export\DirectExportInterface) { + if ($export instanceof DirectExportInterface) { return $reverse ? 'centers' : 'generate'; } diff --git a/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php b/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php index 24253de36..a8a9c0610 100644 --- a/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php @@ -24,7 +24,9 @@ use Symfony\Component\Serializer\SerializerInterface; class GeographicalUnitByAddressApiController { - public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly Security $security, private readonly SerializerInterface $serializer) {} + public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly Security $security, private readonly SerializerInterface $serializer) + { + } /** * @Route("/api/1.0/main/geographical-unit/by-address/{id}.{_format}", requirements={"_format": "json"}) diff --git a/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php b/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php index 418f49578..bc28f9d12 100644 --- a/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php +++ b/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php @@ -13,4 +13,6 @@ namespace Chill\MainBundle\Controller; use Chill\MainBundle\CRUD\Controller\CRUDController; -class LocationTypeController extends CRUDController {} +class LocationTypeController extends CRUDController +{ +} diff --git a/src/Bundle/ChillMainBundle/Controller/LoginController.php b/src/Bundle/ChillMainBundle/Controller/LoginController.php index df295d0b2..e04f478a8 100644 --- a/src/Bundle/ChillMainBundle/Controller/LoginController.php +++ b/src/Bundle/ChillMainBundle/Controller/LoginController.php @@ -46,5 +46,7 @@ class LoginController extends AbstractController ]); } - public function LoginCheckAction(Request $request) {} + public function LoginCheckAction(Request $request) + { + } } diff --git a/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php b/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php index 16599b9a2..42f0e5469 100644 --- a/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php @@ -31,7 +31,9 @@ use Symfony\Component\Serializer\SerializerInterface; */ class NotificationApiController { - public function __construct(private readonly EntityManagerInterface $entityManager, private readonly NotificationRepository $notificationRepository, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly SerializerInterface $serializer) {} + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly NotificationRepository $notificationRepository, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly SerializerInterface $serializer) + { + } /** * @Route("/{id}/mark/read", name="chill_api_main_notification_mark_read", methods={"POST"}) diff --git a/src/Bundle/ChillMainBundle/Controller/NotificationController.php b/src/Bundle/ChillMainBundle/Controller/NotificationController.php index 4131ba714..4d962248c 100644 --- a/src/Bundle/ChillMainBundle/Controller/NotificationController.php +++ b/src/Bundle/ChillMainBundle/Controller/NotificationController.php @@ -41,7 +41,9 @@ use function in_array; */ class NotificationController extends AbstractController { - public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $chillLogger, private readonly LoggerInterface $logger, private readonly Security $security, private readonly NotificationRepository $notificationRepository, private readonly NotificationHandlerManager $notificationHandlerManager, private readonly PaginatorFactory $paginatorFactory, private readonly TranslatorInterface $translator, private readonly UserRepository $userRepository) {} + public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $chillLogger, private readonly LoggerInterface $logger, private readonly Security $security, private readonly NotificationRepository $notificationRepository, private readonly NotificationHandlerManager $notificationHandlerManager, private readonly PaginatorFactory $paginatorFactory, private readonly TranslatorInterface $translator, private readonly UserRepository $userRepository) + { + } /** * @Route("/create", name="chill_main_notification_create") diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php b/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php index 8b0561635..97b255a85 100644 --- a/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php @@ -21,7 +21,9 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; class PermissionApiController extends AbstractController { - public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly Security $security) {} + public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly Security $security) + { + } /** * @Route("/api/1.0/main/permissions/info.json", methods={"POST"}) diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php index 681046ca1..b5fdeca7e 100644 --- a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php +++ b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php @@ -47,7 +47,8 @@ final class PermissionsGroupController extends AbstractController private readonly EntityManagerInterface $em, private readonly PermissionsGroupRepository $permissionsGroupRepository, private readonly RoleScopeRepository $roleScopeRepository, - ) {} + ) { + } /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/add_link_role_scope", name="admin_permissionsgroup_add_role_scope", methods={"PUT"}) diff --git a/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php index 2b897130d..e51f74e40 100644 --- a/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php +++ b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php @@ -26,7 +26,9 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; final class PostalCodeAPIController extends ApiController { - public function __construct(private readonly CountryRepository $countryRepository, private readonly PostalCodeRepositoryInterface $postalCodeRepository, private readonly PaginatorFactory $paginatorFactory) {} + public function __construct(private readonly CountryRepository $countryRepository, private readonly PostalCodeRepositoryInterface $postalCodeRepository, private readonly PaginatorFactory $paginatorFactory) + { + } /** * @Route("/api/1.0/main/postal-code/search.json") diff --git a/src/Bundle/ChillMainBundle/Controller/SavedExportController.php b/src/Bundle/ChillMainBundle/Controller/SavedExportController.php index 15bfcb9bb..0269ff0f5 100644 --- a/src/Bundle/ChillMainBundle/Controller/SavedExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/SavedExportController.php @@ -34,7 +34,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class SavedExportController { - public function __construct(private readonly \Twig\Environment $templating, private readonly EntityManagerInterface $entityManager, private readonly ExportManager $exportManager, private readonly FormFactoryInterface $formFactory, private readonly SavedExportRepositoryInterface $savedExportRepository, private readonly Security $security, private readonly SessionInterface $session, private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator) {} + public function __construct(private readonly \Twig\Environment $templating, private readonly EntityManagerInterface $entityManager, private readonly ExportManager $exportManager, private readonly FormFactoryInterface $formFactory, private readonly SavedExportRepositoryInterface $savedExportRepository, private readonly Security $security, private readonly SessionInterface $session, private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator) + { + } /** * @Route("/{_locale}/exports/saved/{id}/delete", name="chill_main_export_saved_delete") diff --git a/src/Bundle/ChillMainBundle/Controller/ScopeController.php b/src/Bundle/ChillMainBundle/Controller/ScopeController.php index 727796256..3ccf13c07 100644 --- a/src/Bundle/ChillMainBundle/Controller/ScopeController.php +++ b/src/Bundle/ChillMainBundle/Controller/ScopeController.php @@ -56,7 +56,7 @@ class ScopeController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $scope = $em->getRepository(\Chill\MainBundle\Entity\Scope::class)->find($id); + $scope = $em->getRepository(Scope::class)->find($id); if (!$scope) { throw $this->createNotFoundException('Unable to find Scope entity.'); @@ -79,7 +79,7 @@ class ScopeController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $entities = $em->getRepository(\Chill\MainBundle\Entity\Scope::class)->findAll(); + $entities = $em->getRepository(Scope::class)->findAll(); return $this->render('@ChillMain/Scope/index.html.twig', [ 'entities' => $entities, @@ -109,7 +109,7 @@ class ScopeController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $scope = $em->getRepository(\Chill\MainBundle\Entity\Scope::class)->find($id); + $scope = $em->getRepository(Scope::class)->find($id); if (!$scope) { throw $this->createNotFoundException('Unable to find Scope entity.'); @@ -129,7 +129,7 @@ class ScopeController extends AbstractController { $em = $this->getDoctrine()->getManager(); - $scope = $em->getRepository(\Chill\MainBundle\Entity\Scope::class)->find($id); + $scope = $em->getRepository(Scope::class)->find($id); if (!$scope) { throw $this->createNotFoundException('Unable to find Scope entity.'); diff --git a/src/Bundle/ChillMainBundle/Controller/SearchController.php b/src/Bundle/ChillMainBundle/Controller/SearchController.php index 6324561cc..b5d359a53 100644 --- a/src/Bundle/ChillMainBundle/Controller/SearchController.php +++ b/src/Bundle/ChillMainBundle/Controller/SearchController.php @@ -32,7 +32,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class SearchController extends AbstractController { - public function __construct(protected SearchProvider $searchProvider, protected TranslatorInterface $translator, protected PaginatorFactory $paginatorFactory, protected SearchApi $searchApi) {} + public function __construct(protected SearchProvider $searchProvider, protected TranslatorInterface $translator, protected PaginatorFactory $paginatorFactory, protected SearchApi $searchApi) + { + } /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search/advanced/{name}", name="chill_main_advanced_search") @@ -45,7 +47,7 @@ class SearchController extends AbstractController /** @var Chill\MainBundle\Search\HasAdvancedSearchFormInterface $variable */ $search = $this->searchProvider ->getHasAdvancedFormByName($name); - } catch (\Chill\MainBundle\Search\UnknowSearchNameException) { + } catch (UnknowSearchNameException) { throw $this->createNotFoundException('no advanced search for '."{$name}"); } diff --git a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php index ebbd7a360..7999cb697 100644 --- a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php +++ b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php @@ -20,7 +20,9 @@ use Symfony\Component\Security\Core\Security; class TimelineCenterController extends AbstractController { - public function __construct(protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory, private readonly Security $security) {} + public function __construct(protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory, private readonly Security $security) + { + } /** * @Route("/{_locale}/center/timeline", diff --git a/src/Bundle/ChillMainBundle/Controller/UserController.php b/src/Bundle/ChillMainBundle/Controller/UserController.php index 1a25c4ad4..69e9a5d80 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserController.php @@ -38,7 +38,9 @@ class UserController extends CRUDController { final public const FORM_GROUP_CENTER_COMPOSED = 'composed_groupcenter'; - public function __construct(private readonly LoggerInterface $logger, private readonly ValidatorInterface $validator, private readonly UserPasswordEncoderInterface $passwordEncoder, private readonly UserRepository $userRepository, protected ParameterBagInterface $parameterBag, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly LoggerInterface $logger, private readonly ValidatorInterface $validator, private readonly UserPasswordEncoderInterface $passwordEncoder, private readonly UserRepository $userRepository, protected ParameterBagInterface $parameterBag, private readonly TranslatorInterface $translator) + { + } /** * @Route("/{_locale}/admin/main/user/{uid}/add_link_groupcenter", @@ -48,7 +50,7 @@ class UserController extends CRUDController { $em = $this->getDoctrine()->getManager(); - $user = $em->getRepository(\Chill\MainBundle\Entity\User::class)->find($uid); + $user = $em->getRepository(User::class)->find($uid); if (!$user) { throw $this->createNotFoundException('Unable to find User entity.'); @@ -100,13 +102,13 @@ class UserController extends CRUDController { $em = $this->getDoctrine()->getManager(); - $user = $em->getRepository(\Chill\MainBundle\Entity\User::class)->find($uid); + $user = $em->getRepository(User::class)->find($uid); if (!$user) { throw $this->createNotFoundException('Unable to find User entity.'); } - $groupCenter = $em->getRepository(\Chill\MainBundle\Entity\GroupCenter::class) + $groupCenter = $em->getRepository(GroupCenter::class) ->find($gcid); if (!$groupCenter) { @@ -424,7 +426,7 @@ class UserController extends CRUDController { $em = $this->getDoctrine()->getManager(); - $groupCenterManaged = $em->getRepository(\Chill\MainBundle\Entity\GroupCenter::class) + $groupCenterManaged = $em->getRepository(GroupCenter::class) ->findOneBy([ 'center' => $groupCenter->getCenter(), 'permissionsGroup' => $groupCenter->getPermissionsGroup(), diff --git a/src/Bundle/ChillMainBundle/Controller/UserExportController.php b/src/Bundle/ChillMainBundle/Controller/UserExportController.php index 7f14b5e64..41c2d1a85 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserExportController.php @@ -27,7 +27,8 @@ final readonly class UserExportController private UserRepositoryInterface $userRepository, private Security $security, private TranslatorInterface $translator, - ) {} + ) { + } /** * @throws \League\Csv\CannotInsertRecord diff --git a/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php b/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php index 55d7aceb7..144c27688 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php @@ -21,7 +21,8 @@ class UserJobScopeHistoriesController extends AbstractController { public function __construct( private readonly Environment $engine, - ) {} + ) { + } /** * @Route("/{_locale}/admin/main/user/{id}/job-scope-history", name="admin_user_job_scope_history") diff --git a/src/Bundle/ChillMainBundle/Controller/UserProfileController.php b/src/Bundle/ChillMainBundle/Controller/UserProfileController.php new file mode 100644 index 000000000..3b83069bb --- /dev/null +++ b/src/Bundle/ChillMainBundle/Controller/UserProfileController.php @@ -0,0 +1,66 @@ +getUser(); + $editForm = $this->createPhonenumberEditForm($user); + $editForm->handleRequest($request); + + if ($editForm->isSubmitted() && $editForm->isValid()) { + $phonenumber = $editForm->get('phonenumber')->getData(); + + $user->setPhonenumber($phonenumber); + + $this->getDoctrine()->getManager()->flush(); + $this->addFlash('success', $this->translator->trans('user.profile.Phonenumber successfully updated!')); + + return $this->redirectToRoute('chill_main_user_profile'); + } + + return $this->render('@ChillMain/User/profile.html.twig', [ + 'user' => $user, + 'form' => $editForm->createView(), + ]); + } + + private function createPhonenumberEditForm(UserInterface $user): FormInterface + { + return $this->createForm( + UserPhonenumberType::class, + $user, + ) + ->add('submit', SubmitType::class, ['label' => $this->translator->trans('Save')]); + } +} diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php index 4c4d8218c..dd7d642c9 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php @@ -29,7 +29,9 @@ use Symfony\Component\Serializer\SerializerInterface; class WorkflowApiController { - public function __construct(private readonly EntityManagerInterface $entityManager, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly SerializerInterface $serializer) {} + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly SerializerInterface $serializer) + { + } /** * Return a list of workflow which are waiting an action for the user. diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php index b641ed46a..a88248c1a 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php @@ -38,7 +38,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class WorkflowController extends AbstractController { - public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly ValidatorInterface $validator, private readonly PaginatorFactory $paginatorFactory, private readonly Registry $registry, private readonly EntityManagerInterface $entityManager, private readonly TranslatorInterface $translator, private readonly Security $security) {} + public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly ValidatorInterface $validator, private readonly PaginatorFactory $paginatorFactory, private readonly Registry $registry, private readonly EntityManagerInterface $entityManager, private readonly TranslatorInterface $translator, private readonly Security $security) + { + } /** * @Route("/{_locale}/main/workflow/create", name="chill_main_workflow_create") diff --git a/src/Bundle/ChillMainBundle/Cron/CronManager.php b/src/Bundle/ChillMainBundle/Cron/CronManager.php index 3db7d5dc3..147d035cd 100644 --- a/src/Bundle/ChillMainBundle/Cron/CronManager.php +++ b/src/Bundle/ChillMainBundle/Cron/CronManager.php @@ -55,7 +55,8 @@ final readonly class CronManager implements CronManagerInterface private EntityManagerInterface $entityManager, private iterable $jobs, private LoggerInterface $logger - ) {} + ) { + } public function run(string $forceJob = null): void { diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index c91f03516..b88439314 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -602,7 +602,7 @@ class ChillMainExtension extends Extension implements ], ], [ - 'class' => \Chill\MainBundle\Entity\UserJob::class, + 'class' => UserJob::class, 'name' => 'user_job', 'base_path' => '/api/1.0/main/user-job', 'base_role' => 'ROLE_USER', @@ -666,7 +666,7 @@ class ChillMainExtension extends Extension implements ], ], [ - 'class' => \Chill\MainBundle\Entity\Country::class, + 'class' => Country::class, 'name' => 'country', 'base_path' => '/api/1.0/main/country', 'base_role' => 'ROLE_USER', @@ -686,7 +686,7 @@ class ChillMainExtension extends Extension implements ], ], [ - 'class' => \Chill\MainBundle\Entity\User::class, + 'class' => User::class, 'controller' => \Chill\MainBundle\Controller\UserApiController::class, 'name' => 'user', 'base_path' => '/api/1.0/main/user', @@ -728,7 +728,7 @@ class ChillMainExtension extends Extension implements ], ], [ - 'class' => \Chill\MainBundle\Entity\Location::class, + 'class' => Location::class, 'controller' => \Chill\MainBundle\Controller\LocationApiController::class, 'name' => 'location', 'base_path' => '/api/1.0/main/location', @@ -750,7 +750,7 @@ class ChillMainExtension extends Extension implements ], ], [ - 'class' => \Chill\MainBundle\Entity\LocationType::class, + 'class' => LocationType::class, 'controller' => \Chill\MainBundle\Controller\LocationTypeApiController::class, 'name' => 'location_type', 'base_path' => '/api/1.0/main/location-type', @@ -771,7 +771,7 @@ class ChillMainExtension extends Extension implements ], ], [ - 'class' => \Chill\MainBundle\Entity\Civility::class, + 'class' => Civility::class, 'name' => 'civility', 'base_path' => '/api/1.0/main/civility', 'base_role' => 'ROLE_USER', diff --git a/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php b/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php index e6ac2308a..907997258 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php @@ -21,7 +21,9 @@ use Symfony\Component\Security\Core\Security; class TrackCreateUpdateSubscriber implements EventSubscriber { - public function __construct(private readonly Security $security) {} + public function __construct(private readonly Security $security) + { + } public function getSubscribedEvents() { diff --git a/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php b/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php index de6af9625..beed15f31 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php @@ -15,7 +15,9 @@ class Point implements \JsonSerializable { public static string $SRID = '4326'; - private function __construct(private readonly ?float $lon, private readonly ?float $lat) {} + private function __construct(private readonly ?float $lon, private readonly ?float $lat) + { + } public static function fromArrayGeoJson(array $array): self { diff --git a/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php b/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php index 79e28e6f3..a36e798a4 100644 --- a/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php +++ b/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php @@ -53,5 +53,6 @@ class SimpleGeographicalUnitDTO * @Serializer\Groups({"read"}) */ public int $layerId - ) {} + ) { + } } diff --git a/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php b/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php index 501e28a9a..4a28267cd 100644 --- a/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php +++ b/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php @@ -73,8 +73,8 @@ class PermissionsGroup */ public function __construct() { - $this->roleScopes = new \Doctrine\Common\Collections\ArrayCollection(); - $this->groupCenters = new \Doctrine\Common\Collections\ArrayCollection(); + $this->roleScopes = new ArrayCollection(); + $this->groupCenters = new ArrayCollection(); } public function addRoleScope(RoleScope $roleScope) diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index 01655fa3d..423d0f3ba 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -18,9 +18,11 @@ use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Selectable; use Doctrine\ORM\Mapping as ORM; +use libphonenumber\PhoneNumber; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Chill\MainBundle\Validation\Constraint\PhonenumberConstraint; /** * User. @@ -161,6 +163,15 @@ class User implements UserInterface, \Stringable */ private ?string $usernameCanonical = null; + /** + * The user's mobile phone number. + * + * @ORM\Column(type="phone_number", nullable=true) + * + * @PhonenumberConstraint() + */ + private ?PhoneNumber $phonenumber = null; + /** * User constructor. */ @@ -177,7 +188,7 @@ class User implements UserInterface, \Stringable } /** - * @return \Chill\MainBundle\Entity\User + * @return User */ public function addGroupCenter(GroupCenter $groupCenter) { @@ -186,7 +197,9 @@ class User implements UserInterface, \Stringable return $this; } - public function eraseCredentials() {} + public function eraseCredentials() + { + } public function getAbsenceStart(): ?\DateTimeImmutable { @@ -419,6 +432,11 @@ class User implements UserInterface, \Stringable } } + public function getPhonenumber(): ?PhoneNumber + { + return $this->phonenumber; + } + /** * @throws \RuntimeException if the groupCenter is not in the collection */ @@ -639,4 +657,11 @@ class User implements UserInterface, \Stringable return $this; } + + public function setPhonenumber(?PhoneNumber $phonenumber): self + { + $this->phonenumber = $phonenumber; + + return $this; + } } diff --git a/src/Bundle/ChillMainBundle/Export/ExportFormHelper.php b/src/Bundle/ChillMainBundle/Export/ExportFormHelper.php index 4746b6129..c448077e3 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportFormHelper.php +++ b/src/Bundle/ChillMainBundle/Export/ExportFormHelper.php @@ -26,7 +26,8 @@ final readonly class ExportFormHelper private AuthorizationHelperForCurrentUserInterface $authorizationHelper, private ExportManager $exportManager, private FormFactoryInterface $formFactory, - ) {} + ) { + } public function getDefaultData(string $step, DirectExportInterface|ExportInterface $export, array $options = []): array { diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php index 97a37d455..853c177b7 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php @@ -100,7 +100,7 @@ class CSVListFormatter implements FormatterInterface * @param array $filtersData an array containing the filters data. The key are the filters id, and the value are the data * @param array $aggregatorsData an array containing the aggregators data. The key are the filters id, and the value are the data * - * @return \Symfony\Component\HttpFoundation\Response The response to be shown + * @return Response The response to be shown */ public function getResponse( $result, diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php index 02b7409bc..8b32714cc 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php @@ -99,7 +99,7 @@ class CSVPivotedListFormatter implements FormatterInterface * @param array $filtersData an array containing the filters data. The key are the filters id, and the value are the data * @param array $aggregatorsData an array containing the aggregators data. The key are the filters id, and the value are the data * - * @return \Symfony\Component\HttpFoundation\Response The response to be shown + * @return Response The response to be shown */ public function getResponse( $result, diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php index e91095afd..7284ff70a 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php @@ -112,7 +112,7 @@ class SpreadsheetListFormatter implements FormatterInterface * @param array $filtersData an array containing the filters data. The key are the filters id, and the value are the data * @param array $aggregatorsData an array containing the aggregators data. The key are the filters id, and the value are the data * - * @return \Symfony\Component\HttpFoundation\Response The response to be shown + * @return Response The response to be shown */ public function getResponse( $result, diff --git a/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php index 0fad30b4f..3be1af08a 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php @@ -15,7 +15,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class DateTimeHelper { - public function __construct(private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatorInterface $translator) + { + } public function getLabel($header): callable { diff --git a/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php index 9161316e7..07a4f9f88 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php @@ -79,7 +79,9 @@ class ExportAddressHelper */ private ?array $unitRefsKeysCache = []; - public function __construct(private readonly AddressRender $addressRender, private readonly AddressRepository $addressRepository, private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} + public function __construct(private readonly AddressRender $addressRender, private readonly AddressRepository $addressRepository, private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) + { + } public function addSelectClauses(int $params, QueryBuilder $queryBuilder, $entityName = 'address', $prefix = 'add') { diff --git a/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php index 1b561390a..fc19f7466 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php @@ -21,7 +21,9 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface; */ class TranslatableStringExportLabelHelper { - public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) {} + public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) + { + } public function getLabel(string $key, array $values, string $header) { diff --git a/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php index 46e19c2d1..693bb0376 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php @@ -16,7 +16,9 @@ use Chill\MainBundle\Templating\Entity\UserRender; class UserHelper { - public function __construct(private readonly UserRender $userRender, private readonly UserRepositoryInterface $userRepository) {} + public function __construct(private readonly UserRender $userRender, private readonly UserRepositoryInterface $userRepository) + { + } /** * Return a callable that will transform a value into a string representing a user. @@ -92,6 +94,11 @@ class UserHelper } $asStrings = []; + if (array_key_exists('uid', $decoded) || is_numeric($decoded)) { + // this is a single value. We have to wrap it into an array + $decoded = [$decoded]; + } + foreach ($decoded as $userId) { if (is_array($userId)) { $uid = $userId['uid']; diff --git a/src/Bundle/ChillMainBundle/Export/ListInterface.php b/src/Bundle/ChillMainBundle/Export/ListInterface.php index 9b88525ca..53442f0e7 100644 --- a/src/Bundle/ChillMainBundle/Export/ListInterface.php +++ b/src/Bundle/ChillMainBundle/Export/ListInterface.php @@ -20,4 +20,6 @@ namespace Chill\MainBundle\Export; * * When used, the `ExportManager` will not handle aggregator for this class. */ -interface ListInterface extends ExportInterface {} +interface ListInterface extends ExportInterface +{ +} diff --git a/src/Bundle/ChillMainBundle/Export/SortExportElement.php b/src/Bundle/ChillMainBundle/Export/SortExportElement.php index 6228109ed..0536f6569 100644 --- a/src/Bundle/ChillMainBundle/Export/SortExportElement.php +++ b/src/Bundle/ChillMainBundle/Export/SortExportElement.php @@ -17,7 +17,8 @@ final readonly class SortExportElement { public function __construct( private TranslatorInterface $translator, - ) {} + ) { + } /** * @param array $elements diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php index 68fad0a99..10f9c26e3 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php @@ -19,7 +19,9 @@ use Symfony\Component\Security\Core\Security; final class PrivateCommentDataMapper extends AbstractType implements DataMapperInterface { - public function __construct(private readonly Security $security) {} + public function __construct(private readonly Security $security) + { + } public function mapDataToForms($viewData, $forms) { diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/RollingDateDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/RollingDateDataMapper.php index 7628d6aa3..6a139de7b 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/RollingDateDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/RollingDateDataMapper.php @@ -37,9 +37,13 @@ class RollingDateDataMapper implements DataMapperInterface { $forms = iterator_to_array($forms); - $viewData = new RollingDate( - $forms['roll']->getData() ?? RollingDate::T_TODAY, - $forms['fixedDate']->getData() - ); + if (null === $forms['roll']->getData()) { + $viewData = null; + } else { + $viewData = new RollingDate( + $forms['roll']->getData(), + $forms['fixedDate']->getData() + ); + } } } diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php index cf96292af..267927ff1 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php @@ -16,7 +16,9 @@ use Symfony\Component\Form\DataMapperInterface; class ScopePickerDataMapper implements DataMapperInterface { - public function __construct(private readonly ?Scope $scope = null) {} + public function __construct(private readonly ?Scope $scope = null) + { + } public function mapDataToForms($data, $forms) { diff --git a/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php b/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php index 42606ebd7..aba5e2bc4 100644 --- a/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php +++ b/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php @@ -17,7 +17,9 @@ class CustomizeFormEvent extends \Symfony\Contracts\EventDispatcher\Event { final public const NAME = 'chill_main.customize_form'; - public function __construct(protected string $type, protected FormBuilderInterface $builder) {} + public function __construct(protected string $type, protected FormBuilderInterface $builder) + { + } public function getBuilder(): FormBuilderInterface { diff --git a/src/Bundle/ChillMainBundle/Form/LocationFormType.php b/src/Bundle/ChillMainBundle/Form/LocationFormType.php index 7f61cccce..e4748d850 100644 --- a/src/Bundle/ChillMainBundle/Form/LocationFormType.php +++ b/src/Bundle/ChillMainBundle/Form/LocationFormType.php @@ -24,7 +24,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; final class LocationFormType extends AbstractType { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/AppendScopeChoiceTypeTrait.php b/src/Bundle/ChillMainBundle/Form/Type/AppendScopeChoiceTypeTrait.php index fcc4b4ec5..469b9c18e 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/AppendScopeChoiceTypeTrait.php +++ b/src/Bundle/ChillMainBundle/Form/Type/AppendScopeChoiceTypeTrait.php @@ -83,7 +83,7 @@ trait AppendScopeChoiceTypeTrait { $resolver ->setRequired(['center', 'role']) - ->setAllowedTypes('center', \Chill\MainBundle\Entity\Center::class) + ->setAllowedTypes('center', Center::class) ->setAllowedTypes('role', 'string'); } diff --git a/src/Bundle/ChillMainBundle/Form/Type/ComposedGroupCenterType.php b/src/Bundle/ChillMainBundle/Form/Type/ComposedGroupCenterType.php index 48bd37dcc..1f6e08571 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ComposedGroupCenterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ComposedGroupCenterType.php @@ -23,10 +23,10 @@ class ComposedGroupCenterType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('permissionsgroup', EntityType::class, [ - 'class' => \Chill\MainBundle\Entity\PermissionsGroup::class, + 'class' => PermissionsGroup::class, 'choice_label' => static fn (PermissionsGroup $group) => $group->getName(), ])->add('center', EntityType::class, [ - 'class' => \Chill\MainBundle\Entity\Center::class, + 'class' => Center::class, 'choice_label' => static fn (Center $center) => $center->getName(), ]); } diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php index 04094537b..c04a4b158 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php @@ -17,7 +17,9 @@ use Symfony\Component\Form\Exception\TransformationFailedException; final readonly class AddressToIdDataTransformer implements DataTransformerInterface { - public function __construct(private AddressRepository $addressRepository) {} + public function __construct(private AddressRepository $addressRepository) + { + } public function reverseTransform($value) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php index d328d38f0..9a8b0a6d7 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException; class CenterTransformer implements DataTransformerInterface { - public function __construct(private readonly CenterRepository $centerRepository, private readonly bool $multiple = false) {} + public function __construct(private readonly CenterRepository $centerRepository, private readonly bool $multiple = false) + { + } public function reverseTransform($id) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php index d193ea2ef..bd54b0c09 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php @@ -22,7 +22,9 @@ use Symfony\Component\Serializer\SerializerInterface; class EntityToJsonTransformer implements DataTransformerInterface { - public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly bool $multiple, private readonly string $type) {} + public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly bool $multiple, private readonly string $type) + { + } public function reverseTransform($value) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php index 808093278..436b72ce3 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php @@ -17,7 +17,9 @@ use Symfony\Component\Form\DataTransformerInterface; class MultipleObjectsToIdTransformer implements DataTransformerInterface { - public function __construct(private readonly EntityManagerInterface $em, private readonly ?string $class = null) {} + public function __construct(private readonly EntityManagerInterface $em, private readonly ?string $class = null) + { + } /** * Transforms a string (id) to an object (item). diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php index e56778bf2..ffdee60bd 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php @@ -17,7 +17,9 @@ use Symfony\Component\Form\Exception\TransformationFailedException; class ObjectToIdTransformer implements DataTransformerInterface { - public function __construct(private readonly EntityManagerInterface $em, private readonly ?string $class = null) {} + public function __construct(private readonly EntityManagerInterface $em, private readonly ?string $class = null) + { + } /** * Transforms a string (id) to an object. diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php index dde8b7b9e..5f9117577 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php @@ -18,7 +18,9 @@ use Symfony\Component\Form\Exception\TransformationFailedException; class PostalCodeToIdTransformer implements DataTransformerInterface { - public function __construct(private readonly PostalCodeRepositoryInterface $postalCodeRepository) {} + public function __construct(private readonly PostalCodeRepositoryInterface $postalCodeRepository) + { + } public function reverseTransform($value) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php index 2779f2cdd..cb5adec47 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php @@ -18,7 +18,9 @@ use Symfony\Component\Form\Exception\TransformationFailedException; class ScopeTransformer implements DataTransformerInterface { - public function __construct(private readonly EntityManagerInterface $em) {} + public function __construct(private readonly EntityManagerInterface $em) + { + } public function reverseTransform($id) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/AggregatorType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/AggregatorType.php index cfcf4a471..1ea01d5f8 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/AggregatorType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/AggregatorType.php @@ -19,7 +19,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class AggregatorType extends AbstractType { - public function __construct() {} + public function __construct() + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php index e5d0887f3..930712084 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php @@ -29,7 +29,9 @@ class ExportType extends AbstractType final public const PICK_FORMATTER_KEY = 'pick_formatter'; - public function __construct(private readonly ExportManager $exportManager, private readonly SortExportElement $sortExportElement) {} + public function __construct(private readonly ExportManager $exportManager, private readonly SortExportElement $sortExportElement) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php index bcf842e73..8491d8f6a 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php @@ -22,7 +22,9 @@ class FilterType extends AbstractType { final public const ENABLED_FIELD = 'enabled'; - public function __construct() {} + public function __construct() + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php index a093dda44..01e3ba60a 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php @@ -33,7 +33,8 @@ final class PickCenterType extends AbstractType private readonly ExportManager $exportManager, private readonly RegroupmentRepository $regroupmentRepository, private readonly AuthorizationHelperForCurrentUserInterface $authorizationHelper - ) {} + ) { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php b/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php index 190e09f30..8750ee006 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php @@ -41,7 +41,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ final class PickAddressType extends AbstractType { - public function __construct(private readonly AddressToIdDataTransformer $addressToIdDataTransformer, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly AddressToIdDataTransformer $addressToIdDataTransformer, private readonly TranslatorInterface $translator) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php b/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php index ba6cc874d..12b170a73 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php @@ -34,7 +34,9 @@ use function count; */ class PickCenterType extends AbstractType { - public function __construct(protected AuthorizationHelperInterface $authorizationHelper, protected Security $security, protected CenterRepository $centerRepository) {} + public function __construct(protected AuthorizationHelperInterface $authorizationHelper, protected Security $security, protected CenterRepository $centerRepository) + { + } /** * add a data transformer if user can reach only one center. diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php b/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php index f9aa09ce8..abe190de5 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php @@ -21,7 +21,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickCivilityType extends AbstractType { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php b/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php index 8aa216da1..7fb50fd4a 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php @@ -19,7 +19,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickLocationTypeType extends AbstractType { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php b/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php index 1a1ed4354..041176905 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php @@ -21,7 +21,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickPostalCodeType extends AbstractType { - public function __construct(private readonly PostalCodeToIdTransformer $postalCodeToIdTransformer) {} + public function __construct(private readonly PostalCodeToIdTransformer $postalCodeToIdTransformer) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickRollingDateType.php b/src/Bundle/ChillMainBundle/Form/Type/PickRollingDateType.php index 8ceb08578..ca10530e8 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickRollingDateType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickRollingDateType.php @@ -54,7 +54,7 @@ class PickRollingDateType extends AbstractType { $resolver->setDefaults([ 'class' => RollingDate::class, - 'empty_data' => new RollingDate(RollingDate::T_TODAY), + 'empty_data' => null, 'constraints' => [ new Callback($this->validate(...)), ], @@ -66,6 +66,10 @@ class PickRollingDateType extends AbstractType public function validate($data, ExecutionContextInterface $context, $payload): void { + if (null === $data) { + return; + } + /** @var RollingDate $data */ if (RollingDate::T_FIXED_DATE === $data->getRoll() && null === $data->getFixedDate()) { $context diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php b/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php index 9a4fbdd75..a12042dab 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php @@ -27,7 +27,9 @@ use Symfony\Component\Serializer\SerializerInterface; */ class PickUserDynamicType extends AbstractType { - public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly NormalizerInterface $normalizer) {} + public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly NormalizerInterface $normalizer) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php b/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php index 9d1cdb626..bea96b79b 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php @@ -20,7 +20,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickUserLocationType extends AbstractType { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly LocationRepository $locationRepository) {} + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly LocationRepository $locationRepository) + { + } public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php b/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php index 0d26b5a95..44354922f 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php @@ -21,7 +21,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PrivateCommentType extends AbstractType { - public function __construct(protected PrivateCommentDataMapper $dataMapper) {} + public function __construct(protected PrivateCommentDataMapper $dataMapper) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php index 68ae84549..fd27a9bcb 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php @@ -39,7 +39,9 @@ use Symfony\Component\Security\Core\Security; */ class ScopePickerType extends AbstractType { - public function __construct(private readonly AuthorizationHelperInterface $authorizationHelper, private readonly Security $security, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} + public function __construct(private readonly AuthorizationHelperInterface $authorizationHelper, private readonly Security $security, private readonly TranslatableStringHelperInterface $translatableStringHelper) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php index 39648c11a..370de1137 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php @@ -26,7 +26,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; */ class Select2CountryType extends AbstractType { - public function __construct(private readonly RequestStack $requestStack, private readonly ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) {} + public function __construct(private readonly RequestStack $requestStack, private readonly ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { @@ -56,7 +58,7 @@ class Select2CountryType extends AbstractType asort($choices, \SORT_STRING | \SORT_FLAG_CASE); $resolver->setDefaults([ - 'class' => \Chill\MainBundle\Entity\Country::class, + 'class' => Country::class, 'choices' => array_combine(array_values($choices), array_keys($choices)), 'preferred_choices' => array_combine(array_values($preferredChoices), array_keys($preferredChoices)), ]); diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php index bc25ac638..9d634857a 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php @@ -26,7 +26,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; */ class Select2LanguageType extends AbstractType { - public function __construct(private readonly RequestStack $requestStack, private readonly ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) {} + public function __construct(private readonly RequestStack $requestStack, private readonly ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { @@ -52,7 +54,7 @@ class Select2LanguageType extends AbstractType asort($choices, \SORT_STRING | \SORT_FLAG_CASE); $resolver->setDefaults([ - 'class' => \Chill\MainBundle\Entity\Language::class, + 'class' => Language::class, 'choices' => array_combine(array_values($choices), array_keys($choices)), 'preferred_choices' => array_combine(array_values($preferredChoices), array_keys($preferredChoices)), ]); diff --git a/src/Bundle/ChillMainBundle/Form/UserPhonenumberType.php b/src/Bundle/ChillMainBundle/Form/UserPhonenumberType.php new file mode 100644 index 000000000..579829b84 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Form/UserPhonenumberType.php @@ -0,0 +1,36 @@ +add('phonenumber', ChillPhoneNumberType::class, [ + 'required' => false, + ]); + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => User::class, + ]); + } +} diff --git a/src/Bundle/ChillMainBundle/Form/UserType.php b/src/Bundle/ChillMainBundle/Form/UserType.php index cb5e05c13..4a6bb8f9a 100644 --- a/src/Bundle/ChillMainBundle/Form/UserType.php +++ b/src/Bundle/ChillMainBundle/Form/UserType.php @@ -16,6 +16,7 @@ use Chill\MainBundle\Entity\Location; use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Entity\UserJob; use Chill\MainBundle\Form\Type\ChillDateType; +use Chill\MainBundle\Form\Type\ChillPhoneNumberType; use Chill\MainBundle\Form\Type\PickCivilityType; use Chill\MainBundle\Templating\TranslatableStringHelper; use Doctrine\ORM\EntityRepository; @@ -35,7 +36,9 @@ use Symfony\Component\Validator\Constraints\Regex; class UserType extends AbstractType { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) {} + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { @@ -44,6 +47,9 @@ class UserType extends AbstractType ->add('email', EmailType::class, [ 'required' => true, ]) + ->add('phonenumber', ChillPhoneNumberType::class, [ + 'required' => false, + ]) ->add('label', TextType::class) ->add('civility', PickCivilityType::class, [ 'required' => false, diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php index 208af8522..f0360d4bb 100644 --- a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php +++ b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php @@ -34,11 +34,13 @@ use Symfony\Component\Workflow\Transition; class WorkflowStepType extends AbstractType { - public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly Registry $registry, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} + public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly Registry $registry, private readonly TranslatableStringHelperInterface $translatableStringHelper) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { - /** @var \Chill\MainBundle\Entity\Workflow\EntityWorkflow $entityWorkflow */ + /** @var EntityWorkflow $entityWorkflow */ $entityWorkflow = $options['entity_workflow']; $handler = $this->entityWorkflowManager->getHandler($entityWorkflow); $workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName()); diff --git a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php index 1b4c2d7df..81a8bb3bb 100644 --- a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php +++ b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php @@ -23,7 +23,9 @@ use Symfony\Component\Security\Core\User\UserInterface; final readonly class NotificationByUserCounter implements NotificationCounterInterface { - public function __construct(private CacheItemPoolInterface $cacheItemPool, private NotificationRepository $notificationRepository) {} + public function __construct(private CacheItemPoolInterface $cacheItemPool, private NotificationRepository $notificationRepository) + { + } public function addNotification(UserInterface $u): int { diff --git a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php index 7b535f1a7..7eba06242 100644 --- a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php @@ -24,7 +24,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class NotificationMailer { - public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator) + { + } public function postPersistComment(NotificationComment $comment, PostPersistEventArgs $eventArgs): void { diff --git a/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php b/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php index 74c784b4b..fc2cd35ea 100644 --- a/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php +++ b/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php @@ -18,7 +18,9 @@ use Symfony\Component\HttpKernel\Event\TerminateEvent; class PersistNotificationOnTerminateEventSubscriber implements EventSubscriberInterface { - public function __construct(private readonly EntityManagerInterface $em, private readonly NotificationPersisterInterface $persister) {} + public function __construct(private readonly EntityManagerInterface $em, private readonly NotificationPersisterInterface $persister) + { + } public static function getSubscribedEvents() { diff --git a/src/Bundle/ChillMainBundle/Notification/Exception/NotificationHandlerNotFound.php b/src/Bundle/ChillMainBundle/Notification/Exception/NotificationHandlerNotFound.php index b1acff57b..a55104d23 100644 --- a/src/Bundle/ChillMainBundle/Notification/Exception/NotificationHandlerNotFound.php +++ b/src/Bundle/ChillMainBundle/Notification/Exception/NotificationHandlerNotFound.php @@ -11,4 +11,6 @@ declare(strict_types=1); namespace Chill\MainBundle\Notification\Exception; -class NotificationHandlerNotFound extends \RuntimeException {} +class NotificationHandlerNotFound extends \RuntimeException +{ +} diff --git a/src/Bundle/ChillMainBundle/Notification/Mailer.php b/src/Bundle/ChillMainBundle/Notification/Mailer.php index 5dacbc6fa..246480361 100644 --- a/src/Bundle/ChillMainBundle/Notification/Mailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Mailer.php @@ -34,7 +34,9 @@ class Mailer * * @param mixed[] $routeParameters */ - public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly Environment $twig, private readonly RouterInterface $router, private readonly TranslatorInterface $translator, protected $routeParameters) {} + public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly Environment $twig, private readonly RouterInterface $router, private readonly TranslatorInterface $translator, protected $routeParameters) + { + } /** * @return string diff --git a/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php b/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php index aa6e700bc..04116a434 100644 --- a/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php +++ b/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php @@ -17,7 +17,9 @@ use Doctrine\ORM\EntityManagerInterface; final readonly class NotificationHandlerManager { - public function __construct(private iterable $handlers, private EntityManagerInterface $em) {} + public function __construct(private iterable $handlers, private EntityManagerInterface $em) + { + } /** * @throw NotificationHandlerNotFound if handler is not found diff --git a/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php b/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php index 5c5cb3dcf..9b606d18d 100644 --- a/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php +++ b/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php @@ -23,7 +23,9 @@ class NotificationPresence { private array $cache = []; - public function __construct(private readonly Security $security, private readonly NotificationRepository $notificationRepository) {} + public function __construct(private readonly Security $security, private readonly NotificationRepository $notificationRepository) + { + } /** * @param list $more diff --git a/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php b/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php index a65758f5f..8dd2935dd 100644 --- a/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php +++ b/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php @@ -21,7 +21,9 @@ use Twig\Extension\RuntimeExtensionInterface; class NotificationTwigExtensionRuntime implements RuntimeExtensionInterface { - public function __construct(private readonly FormFactoryInterface $formFactory, private readonly NotificationPresence $notificationPresence, private readonly UrlGeneratorInterface $urlGenerator) {} + public function __construct(private readonly FormFactoryInterface $formFactory, private readonly NotificationPresence $notificationPresence, private readonly UrlGeneratorInterface $urlGenerator) + { + } public function counterNotificationFor(Environment $environment, string $relatedEntityClass, int $relatedEntityId, array $more = [], array $options = []): string { diff --git a/src/Bundle/ChillMainBundle/Pagination/PageGenerator.php b/src/Bundle/ChillMainBundle/Pagination/PageGenerator.php index 4c9cb68fe..b887accaa 100644 --- a/src/Bundle/ChillMainBundle/Pagination/PageGenerator.php +++ b/src/Bundle/ChillMainBundle/Pagination/PageGenerator.php @@ -18,7 +18,9 @@ class PageGenerator implements \Iterator { protected int $current = 1; - public function __construct(protected Paginator $paginator) {} + public function __construct(protected Paginator $paginator) + { + } public function current(): Page { diff --git a/src/Bundle/ChillMainBundle/Pagination/Paginator.php b/src/Bundle/ChillMainBundle/Pagination/Paginator.php index a809bc9f4..072437f09 100644 --- a/src/Bundle/ChillMainBundle/Pagination/Paginator.php +++ b/src/Bundle/ChillMainBundle/Pagination/Paginator.php @@ -57,7 +57,8 @@ class Paginator implements PaginatorInterface * the key in the GET parameter to indicate the number of item per page. */ protected string $itemPerPageKey - ) {} + ) { + } public function count(): int { @@ -137,7 +138,7 @@ class Paginator implements PaginatorInterface } /** - * @return \Chill\MainBundle\Pagination\Page + * @return Page * * @throws \RuntimeException if the next page does not exists */ diff --git a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php index 4bf651280..166dcdb68 100644 --- a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php +++ b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php @@ -42,7 +42,8 @@ class PaginatorFactory * the request or inside the paginator. */ private $itemPerPage = 20 - ) {} + ) { + } /** * create a paginator instance. diff --git a/src/Bundle/ChillMainBundle/Phonenumber/Templating.php b/src/Bundle/ChillMainBundle/Phonenumber/Templating.php index 51d57c9e9..69da56eca 100644 --- a/src/Bundle/ChillMainBundle/Phonenumber/Templating.php +++ b/src/Bundle/ChillMainBundle/Phonenumber/Templating.php @@ -16,7 +16,9 @@ use Twig\TwigFilter; class Templating extends AbstractExtension { - public function __construct(protected PhonenumberHelper $phonenumberHelper) {} + public function __construct(protected PhonenumberHelper $phonenumberHelper) + { + } public function formatPhonenumber($phonenumber) { diff --git a/src/Bundle/ChillMainBundle/Redis/ChillRedis.php b/src/Bundle/ChillMainBundle/Redis/ChillRedis.php index b9e454b46..439bb3558 100644 --- a/src/Bundle/ChillMainBundle/Redis/ChillRedis.php +++ b/src/Bundle/ChillMainBundle/Redis/ChillRedis.php @@ -16,4 +16,6 @@ use Redis; /** * Redis client configured by chill main. */ -class ChillRedis extends \Redis {} +class ChillRedis extends \Redis +{ +} diff --git a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php index f14424f6f..5b830ce27 100644 --- a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php @@ -19,7 +19,9 @@ use Doctrine\ORM\EntityManagerInterface; class UserACLAwareRepository implements UserACLAwareRepositoryInterface { - public function __construct(private readonly ParentRoleHelper $parentRoleHelper, private readonly EntityManagerInterface $em) {} + public function __construct(private readonly ParentRoleHelper $parentRoleHelper, private readonly EntityManagerInterface $em) + { + } public function findUsersByReachedACL(string $role, $center, $scope = null, bool $onlyEnabled = true): array { diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/pick-rolling-date/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/pick-rolling-date/index.js index 2600ea40b..9f73c9bf8 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/pick-rolling-date/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/module/pick-rolling-date/index.js @@ -1,7 +1,6 @@ import {ShowHide} from 'ChillMainAssets/lib/show_hide/index'; document.addEventListener('DOMContentLoaded', function(_e) { - console.log('pick-rolling-date'); document.querySelectorAll('div[data-rolling-date]').forEach( (picker) => { const roll_wrapper = picker.querySelector('div.roll-wrapper'), @@ -11,12 +10,8 @@ document.addEventListener('DOMContentLoaded', function(_e) { froms: [roll_wrapper], container: [fixed_wrapper], test: function (elems) { - console.log('testing'); - console.log('elems', elems); for (let el of elems) { for (let select_roll of el.querySelectorAll('select[data-roll-picker]')) { - console.log('select_roll', select_roll); - console.log('value', select_roll.value); return select_roll.value === 'fixed_date'; } } diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig index 82b3e0c0c..e739b871c 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig @@ -28,9 +28,7 @@ {% block js %} {{ encore_entry_script_tags('mod_pickentity_type') }} {{ encore_entry_script_tags('page_export') }} - {% if export_alias == 'count_social_work_actions' %} - {{ encore_entry_script_tags('vue_export_action_goal_result') }} - {% endif %} + {{ encore_entry_script_tags('vue_export_action_goal_result') }} {{ encore_entry_script_tags('mod_pick_rolling_date') }} {% endblock js %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/User/profile.html.twig b/src/Bundle/ChillMainBundle/Resources/views/User/profile.html.twig new file mode 100644 index 000000000..360d748a5 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/User/profile.html.twig @@ -0,0 +1,58 @@ +{# +* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS, + / +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +#} + + +{% extends "@ChillMain/layout.html.twig" %} + + +{% block title %}{{"My profile"|trans}}{% endblock %} + +{% block content %} +
+

{{ 'user.profile.title'|trans }}

+ + +
+
{{ 'Job'|trans }}
+ {% if user.getUserJob is not null %} +
{{ user.getUserJob.label|localize_translatable_string }}
+ {% else %} +
{{ 'user.profile.no job'|trans }}
+ {% endif %} +
{{ 'Scope'|trans }}
+ {% if user.getMainScope is not null %} +
{{ user.getMainScope.name|localize_translatable_string }}
+ {% else %} +
{{ 'user.profile.no scope'|trans }}
+ {% endif %} +
+
+ {{ form_start(form) }} + {{ form_row(form.phonenumber) }} + +
    +
  • + {{ form_widget(form.submit, { 'attr': { 'class': 'btn btn-save' } } ) }} +
  • +
+ + {{ form_end(form) }} +
+
+ +{% endblock %} diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/SectionMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/SectionMenuBuilder.php index ab73932b5..a8deba828 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/SectionMenuBuilder.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/SectionMenuBuilder.php @@ -26,7 +26,9 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface /** * SectionMenuBuilder constructor. */ - public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator, protected ParameterBagInterface $parameterBag) {} + public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator, protected ParameterBagInterface $parameterBag) + { + } public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php index 2c28ff2e8..9775fe474 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php @@ -22,13 +22,23 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UserMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private readonly NotificationByUserCounter $notificationByUserCounter, private readonly WorkflowByUserCounter $workflowByUserCounter, private readonly Security $security, private readonly TranslatorInterface $translator, protected ParameterBagInterface $parameterBag, private readonly RequestStack $requestStack) {} + public function __construct(private readonly NotificationByUserCounter $notificationByUserCounter, private readonly WorkflowByUserCounter $workflowByUserCounter, private readonly Security $security, private readonly TranslatorInterface $translator, protected ParameterBagInterface $parameterBag, private readonly RequestStack $requestStack) + { + } public function buildMenu($menuId, \Knp\Menu\MenuItem $menu, array $parameters) { $user = $this->security->getUser(); if ($user instanceof User) { + $menu->addChild($this->translator->trans('user.profile.title'), [ + 'route' => 'chill_main_user_profile', + ]) + ->setExtras([ + 'order' => -11_111_111, + 'icon' => 'user', + ]); + if (null !== $user->getCurrentLocation()) { $locationTextMenu = $user->getCurrentLocation()->getName(); } else { diff --git a/src/Bundle/ChillMainBundle/Routing/MenuComposer.php b/src/Bundle/ChillMainBundle/Routing/MenuComposer.php index e16b10e8f..a1bd1d52f 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuComposer.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuComposer.php @@ -29,7 +29,9 @@ class MenuComposer private RouteCollection $routeCollection; - public function __construct(private readonly RouterInterface $router, private readonly FactoryInterface $menuFactory, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly RouterInterface $router, private readonly FactoryInterface $menuFactory, private readonly TranslatorInterface $translator) + { + } public function addLocalMenuBuilder(LocalMenuBuilderInterface $menuBuilder, $menuId) { diff --git a/src/Bundle/ChillMainBundle/Routing/MenuTwig.php b/src/Bundle/ChillMainBundle/Routing/MenuTwig.php index 65608ba4d..39e35c040 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuTwig.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuTwig.php @@ -35,7 +35,9 @@ class MenuTwig extends AbstractExtension implements ContainerAwareInterface 'activeRouteKey' => null, ]; - public function __construct(private readonly MenuComposer $menuComposer) {} + public function __construct(private readonly MenuComposer $menuComposer) + { + } /** * Render a Menu corresponding to $menuId. diff --git a/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php b/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php index 12568287d..84d7d3786 100644 --- a/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php +++ b/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php @@ -17,7 +17,9 @@ use Chill\MainBundle\Search\SearchApiQuery; class SearchUserApiProvider implements SearchApiInterface { - public function __construct(private readonly UserRepository $userRepository) {} + public function __construct(private readonly UserRepository $userRepository) + { + } public function getResult(string $key, array $metadata, float $pertinence) { diff --git a/src/Bundle/ChillMainBundle/Search/Model/Result.php b/src/Bundle/ChillMainBundle/Search/Model/Result.php index 1866da2f2..8646819d7 100644 --- a/src/Bundle/ChillMainBundle/Search/Model/Result.php +++ b/src/Bundle/ChillMainBundle/Search/Model/Result.php @@ -19,7 +19,8 @@ class Result * mixed an arbitrary result. */ private $result - ) {} + ) { + } public function getRelevance(): float { diff --git a/src/Bundle/ChillMainBundle/Search/ParsingException.php b/src/Bundle/ChillMainBundle/Search/ParsingException.php index 241079925..b70dd81eb 100644 --- a/src/Bundle/ChillMainBundle/Search/ParsingException.php +++ b/src/Bundle/ChillMainBundle/Search/ParsingException.php @@ -11,4 +11,6 @@ declare(strict_types=1); namespace Chill\MainBundle\Search; -class ParsingException extends \Exception {} +class ParsingException extends \Exception +{ +} diff --git a/src/Bundle/ChillMainBundle/Search/SearchApi.php b/src/Bundle/ChillMainBundle/Search/SearchApi.php index 267b90313..b7307c140 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchApi.php +++ b/src/Bundle/ChillMainBundle/Search/SearchApi.php @@ -20,7 +20,9 @@ use Doctrine\ORM\Query\ResultSetMappingBuilder; class SearchApi { - public function __construct(private readonly EntityManagerInterface $em, private readonly iterable $providers, private readonly PaginatorFactory $paginator) {} + public function __construct(private readonly EntityManagerInterface $em, private readonly iterable $providers, private readonly PaginatorFactory $paginator) + { + } public function getResults(string $pattern, array $types, array $parameters): Collection { diff --git a/src/Bundle/ChillMainBundle/Search/SearchApiResult.php b/src/Bundle/ChillMainBundle/Search/SearchApiResult.php index 14f448746..4fc1cf928 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchApiResult.php +++ b/src/Bundle/ChillMainBundle/Search/SearchApiResult.php @@ -17,7 +17,9 @@ class SearchApiResult { private mixed $result; - public function __construct(private readonly float $relevance) {} + public function __construct(private readonly float $relevance) + { + } /** * @Serializer\Groups({"read"}) diff --git a/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php b/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php index b992b00c1..c753013cb 100644 --- a/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php +++ b/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php @@ -13,7 +13,9 @@ namespace Chill\MainBundle\Search\Utils; class SearchExtractionResult { - public function __construct(private readonly string $filteredSubject, private readonly array $found) {} + public function __construct(private readonly string $filteredSubject, private readonly array $found) + { + } public function getFilteredSubject(): string { diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php index d80020285..352c28be2 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php @@ -18,4 +18,6 @@ use Symfony\Component\Security\Core\Authorization\Voter\Voter; * * This abstract Voter provide generic methods to handle object specific to Chill */ -abstract class AbstractChillVoter extends Voter implements ChillVoterInterface {} +abstract class AbstractChillVoter extends Voter implements ChillVoterInterface +{ +} diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php index e37c3171e..6d9454fe0 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php @@ -34,7 +34,8 @@ class AuthorizationHelper implements AuthorizationHelperInterface private readonly ScopeResolverDispatcher $scopeResolverDispatcher, private readonly UserACLAwareRepositoryInterface $userACLAwareRepository, private readonly ParentRoleHelper $parentRoleHelper - ) {} + ) { + } /** * Filter an array of centers, return only center which are reachable. diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php index e9bb709a8..4bc07f915 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperForCurrentUser.php @@ -17,7 +17,9 @@ use Symfony\Component\Security\Core\Security; class AuthorizationHelperForCurrentUser implements AuthorizationHelperForCurrentUserInterface { - public function __construct(private readonly AuthorizationHelperInterface $authorizationHelper, private readonly Security $security) {} + public function __construct(private readonly AuthorizationHelperInterface $authorizationHelper, private readonly Security $security) + { + } public function getReachableCenters(string $role, Scope $scope = null): array { diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/ChillVoterInterface.php b/src/Bundle/ChillMainBundle/Security/Authorization/ChillVoterInterface.php index f8b0102c7..2ed1856d2 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/ChillVoterInterface.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/ChillVoterInterface.php @@ -14,4 +14,6 @@ namespace Chill\MainBundle\Security\Authorization; /** * Provides methods for compiling voter and build admin role fields. */ -interface ChillVoterInterface {} +interface ChillVoterInterface +{ +} diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php index 071388fcf..edfe83256 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelper.php @@ -18,7 +18,8 @@ final readonly class DefaultVoterHelper implements VoterHelperInterface public function __construct( private AuthorizationHelper $authorizationHelper, private array $configuration - ) {} + ) { + } public function supports($attribute, $subject): bool { diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperFactory.php b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperFactory.php index 805ba03e5..1f16004b2 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperFactory.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperFactory.php @@ -13,7 +13,9 @@ namespace Chill\MainBundle\Security\Authorization; class DefaultVoterHelperFactory implements VoterHelperFactoryInterface { - public function __construct(protected AuthorizationHelper $authorizationHelper) {} + public function __construct(protected AuthorizationHelper $authorizationHelper) + { + } public function generate($context): VoterGeneratorInterface { diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php index 6a1fe5356..e0183cb7f 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php @@ -15,7 +15,9 @@ final class DefaultVoterHelperGenerator implements VoterGeneratorInterface { private array $configuration = []; - public function __construct(private readonly AuthorizationHelper $authorizationHelper) {} + public function __construct(private readonly AuthorizationHelper $authorizationHelper) + { + } public function addCheckFor(?string $class, array $attributes): self { diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php index 44766a583..1da50e22e 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/EntityWorkflowVoter.php @@ -27,7 +27,9 @@ class EntityWorkflowVoter extends Voter final public const SHOW_ENTITY_LINK = 'CHILL_MAIN_WORKFLOW_LINK_SHOW'; - public function __construct(private readonly EntityWorkflowManager $manager, private readonly Security $security) {} + public function __construct(private readonly EntityWorkflowManager $manager, private readonly Security $security) + { + } protected function supports($attribute, $subject) { diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php index 9718cf013..637516ab9 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php @@ -20,7 +20,9 @@ class WorkflowEntityDeletionVoter extends Voter /** * @param \Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface[] $handlers */ - public function __construct(private $handlers, private readonly EntityWorkflowRepository $entityWorkflowRepository) {} + public function __construct(private $handlers, private readonly EntityWorkflowRepository $entityWorkflowRepository) + { + } protected function supports($attribute, $subject) { diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php index 264b77056..5985d8567 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php @@ -30,7 +30,8 @@ class PasswordRecoverEvent extends \Symfony\Contracts\EventDispatcher\Event private readonly ?User $user = null, private $ip = null, private readonly bool $safelyGenerated = false, - ) {} + ) { + } public function getIp() { diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php index e868262e2..46712c6a6 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php @@ -20,7 +20,9 @@ class RecoverPasswordHelper { final public const RECOVER_PASSWORD_ROUTE = 'password_recover'; - public function __construct(private readonly TokenManager $tokenManager, private readonly UrlGeneratorInterface $urlGenerator, private readonly MailerInterface $mailer) {} + public function __construct(private readonly TokenManager $tokenManager, private readonly UrlGeneratorInterface $urlGenerator, private readonly MailerInterface $mailer) + { + } /** * @param bool $absolute diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php index 903b8c5c5..9855477fd 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php @@ -16,7 +16,9 @@ final readonly class CenterResolverDispatcher implements CenterResolverDispatche /** * @param \Chill\MainBundle\Security\Resolver\CenterResolverInterface[] $resolvers */ - public function __construct(private iterable $resolvers = []) {} + public function __construct(private iterable $resolvers = []) + { + } public function resolveCenter($entity, ?array $options = []) { diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php index f629459b4..2ded14071 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php @@ -18,7 +18,9 @@ final readonly class CenterResolverManager implements CenterResolverManagerInter /** * @param \Chill\MainBundle\Security\Resolver\CenterResolverInterface[] $resolvers */ - public function __construct(private iterable $resolvers = []) {} + public function __construct(private iterable $resolvers = []) + { + } public function resolveCenters($entity, ?array $options = []): array { diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php b/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php index 032c28a9b..3959cc5a3 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php @@ -15,7 +15,9 @@ use Twig\TwigFilter; final class ResolverTwigExtension extends \Twig\Extension\AbstractExtension { - public function __construct(private readonly CenterResolverManagerInterface $centerResolverDispatcher, private readonly ScopeResolverDispatcher $scopeResolverDispatcher) {} + public function __construct(private readonly CenterResolverManagerInterface $centerResolverDispatcher, private readonly ScopeResolverDispatcher $scopeResolverDispatcher) + { + } public function getFilters() { diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php index bafadf1a6..a3298eab5 100644 --- a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php +++ b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php @@ -19,7 +19,9 @@ final readonly class ScopeResolverDispatcher /** * @param \Chill\MainBundle\Security\Resolver\ScopeResolverInterface[] $resolvers */ - public function __construct(private iterable $resolvers) {} + public function __construct(private iterable $resolvers) + { + } public function isConcerned($entity, ?array $options = []): bool { diff --git a/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php b/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php index c624c6a99..408128c6f 100644 --- a/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php +++ b/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php @@ -21,7 +21,9 @@ use Symfony\Component\Security\Core\User\UserProviderInterface; class UserProvider implements UserProviderInterface { - public function __construct(protected EntityManagerInterface $em) {} + public function __construct(protected EntityManagerInterface $em) + { + } public function loadUserByUsername($username): UserInterface { diff --git a/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php b/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php index 6349f5d85..9d80eabe9 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php +++ b/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php @@ -15,7 +15,9 @@ use Chill\MainBundle\Pagination\PaginatorInterface; class Collection { - public function __construct(private $items, private readonly PaginatorInterface $paginator) {} + public function __construct(private $items, private readonly PaginatorInterface $paginator) + { + } public function getItems() { diff --git a/src/Bundle/ChillMainBundle/Serializer/Model/Counter.php b/src/Bundle/ChillMainBundle/Serializer/Model/Counter.php index 476d68568..4ef3fe849 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Model/Counter.php +++ b/src/Bundle/ChillMainBundle/Serializer/Model/Counter.php @@ -13,7 +13,9 @@ namespace Chill\MainBundle\Serializer\Model; class Counter implements \JsonSerializable { - public function __construct(private ?int $counter) {} + public function __construct(private ?int $counter) + { + } public function getCounter(): ?int { diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php index bbae6bd40..1a5ebe86b 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php @@ -47,7 +47,9 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw 'confidential', ]; - public function __construct(private readonly AddressRender $addressRender) {} + public function __construct(private readonly AddressRender $addressRender) + { + } /** * @param Address $address diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php index 7c41bcb8a..8e937ee66 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php @@ -20,7 +20,9 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class CenterNormalizer implements DenormalizerInterface, NormalizerInterface { - public function __construct(private readonly CenterRepository $repository) {} + public function __construct(private readonly CenterRepository $repository) + { + } public function denormalize($data, $type, $format = null, array $context = []) { diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php index 41cf94e1b..e1d692a19 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php @@ -23,7 +23,9 @@ class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterfa { use NormalizerAwareTrait; - public function __construct(private readonly UserRepository $userRepository) {} + public function __construct(private readonly UserRepository $userRepository) + { + } /** * @param CommentEmbeddable $object diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php index 9ee8bf158..69e7744e4 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php @@ -20,7 +20,9 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInterface { - public function __construct(private readonly RequestStack $requestStack, private readonly ParameterBagInterface $parameterBag) {} + public function __construct(private readonly RequestStack $requestStack, private readonly ParameterBagInterface $parameterBag) + { + } public function denormalize($data, $type, $format = null, array $context = []) { diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php index ed34a45be..b90f587bb 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php @@ -19,7 +19,9 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; class DoctrineExistingEntityNormalizer implements DenormalizerInterface { - public function __construct(private readonly EntityManagerInterface $em, private readonly ClassMetadataFactoryInterface $serializerMetadataFactory) {} + public function __construct(private readonly EntityManagerInterface $em, private readonly ClassMetadataFactoryInterface $serializerMetadataFactory) + { + } public function denormalize($data, $type, $format = null, array $context = []) { diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php index c4284a526..df125994d 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowNormalizer.php @@ -23,7 +23,9 @@ class EntityWorkflowNormalizer implements NormalizerInterface, NormalizerAwareIn { use NormalizerAwareTrait; - public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly MetadataExtractor $metadataExtractor, private readonly Registry $registry) {} + public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly MetadataExtractor $metadataExtractor, private readonly Registry $registry) + { + } /** * @param EntityWorkflow $object diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php index 1edc6e74c..47ec0427e 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php @@ -21,7 +21,9 @@ class EntityWorkflowStepNormalizer implements NormalizerAwareInterface, Normaliz { use NormalizerAwareTrait; - public function __construct(private readonly MetadataExtractor $metadataExtractor) {} + public function __construct(private readonly MetadataExtractor $metadataExtractor) + { + } /** * @param EntityWorkflowStep $object diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php index 3195f9aab..50b3e33f6 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php @@ -23,7 +23,9 @@ class NotificationNormalizer implements NormalizerAwareInterface, NormalizerInte { use NormalizerAwareTrait; - public function __construct(private readonly NotificationHandlerManager $notificationHandlerManager, private readonly EntityManagerInterface $entityManager, private readonly Security $security) {} + public function __construct(private readonly NotificationHandlerManager $notificationHandlerManager, private readonly EntityManagerInterface $entityManager, private readonly Security $security) + { + } /** * @param Notification $object diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php index 565fa34fc..80407a6b1 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PrivateCommentEmbeddableNormalizer.php @@ -18,7 +18,9 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class PrivateCommentEmbeddableNormalizer implements NormalizerInterface, DenormalizerInterface { - public function __construct(private readonly Security $security) {} + public function __construct(private readonly Security $security) + { + } public function denormalize($data, string $type, string $format = null, array $context = []): PrivateCommentEmbeddable { diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php index 8a80f1492..9843c5dd5 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php @@ -18,6 +18,7 @@ use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\UserJob; use Chill\MainBundle\Templating\Entity\UserRender; +use libphonenumber\PhoneNumber; use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; @@ -34,9 +35,12 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware 'text_without_absent' => '', 'label' => '', 'email' => '', + 'isAbsent' => false, ]; - public function __construct(private readonly UserRender $userRender) {} + public function __construct(private readonly UserRender $userRender) + { + } public function normalize($object, $format = null, array $context = []) { @@ -61,9 +65,13 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware $context, ['docgen:expects' => Civility::class, 'groups' => 'docgen:read'] ); + $phonenumberContext = array_merge( + $context, + ['docgen:expects' => PhoneNumber::class, 'groups' => 'docgen:read'] + ); if (null === $object && 'docgen' === $format) { - return [...self::NULL_USER, 'civility' => $this->normalizer->normalize(null, $format, $civilityContext), 'user_job' => $this->normalizer->normalize(null, $format, $userJobContext), 'main_center' => $this->normalizer->normalize(null, $format, $centerContext), 'main_scope' => $this->normalizer->normalize(null, $format, $scopeContext), 'current_location' => $this->normalizer->normalize(null, $format, $locationContext), 'main_location' => $this->normalizer->normalize(null, $format, $locationContext)]; + return [...self::NULL_USER, 'phonenumber' => $this->normalizer->normalize(null, $format, $phonenumberContext), 'civility' => $this->normalizer->normalize(null, $format, $civilityContext), 'user_job' => $this->normalizer->normalize(null, $format, $userJobContext), 'main_center' => $this->normalizer->normalize(null, $format, $centerContext), 'main_scope' => $this->normalizer->normalize(null, $format, $scopeContext), 'current_location' => $this->normalizer->normalize(null, $format, $locationContext), 'main_location' => $this->normalizer->normalize(null, $format, $locationContext)]; } $data = [ @@ -74,6 +82,7 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware 'text_without_absent' => $this->userRender->renderString($object, ['absence' => false]), 'label' => $object->getLabel(), 'email' => (string) $object->getEmail(), + 'phonenumber' => $this->normalizer->normalize($object->getPhonenumber(), $format, $phonenumberContext), 'user_job' => $this->normalizer->normalize($object->getUserJob(), $format, $userJobContext), 'main_center' => $this->normalizer->normalize($object->getMainCenter(), $format, $centerContext), 'main_scope' => $this->normalizer->normalize($object->getMainScope(), $format, $scopeContext), diff --git a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCode.php b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCode.php index a4589b836..80174053a 100644 --- a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCode.php +++ b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCode.php @@ -100,7 +100,8 @@ final readonly class CollateAddressWithReferenceOrPostalCode implements CollateA public function __construct( private Connection $connection, private LoggerInterface $logger, - ) {} + ) { + } /** * @throws \Throwable diff --git a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCodeCronJob.php b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCodeCronJob.php index ed055a3c3..d2c9fc960 100644 --- a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCodeCronJob.php +++ b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCodeCronJob.php @@ -22,7 +22,8 @@ final readonly class CollateAddressWithReferenceOrPostalCodeCronJob implements C public function __construct( private ClockInterface $clock, private CollateAddressWithReferenceOrPostalCodeInterface $collateAddressWithReferenceOrPostalCode, - ) {} + ) { + } public function canRun(?CronJobExecution $cronJobExecution): bool { diff --git a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php index 06eb2104d..31982d6eb 100644 --- a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php +++ b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php @@ -21,7 +21,8 @@ final readonly class RefreshAddressToGeographicalUnitMaterializedViewCronJob imp public function __construct( private Connection $connection, private ClockInterface $clock, - ) {} + ) { + } public function canRun(?CronJobExecution $cronJobExecution): bool { diff --git a/src/Bundle/ChillMainBundle/Service/EntityInfo/ViewEntityInfoManager.php b/src/Bundle/ChillMainBundle/Service/EntityInfo/ViewEntityInfoManager.php index b545d3979..3484fe288 100644 --- a/src/Bundle/ChillMainBundle/Service/EntityInfo/ViewEntityInfoManager.php +++ b/src/Bundle/ChillMainBundle/Service/EntityInfo/ViewEntityInfoManager.php @@ -23,7 +23,8 @@ class ViewEntityInfoManager private readonly iterable $vienEntityInfoProviders, private readonly Connection $connection, private readonly LoggerInterface $logger, - ) {} + ) { + } public function synchronizeOnDB(): void { diff --git a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBEFromBestAddress.php b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBEFromBestAddress.php index 25749aa89..681d49747 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBEFromBestAddress.php +++ b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBEFromBestAddress.php @@ -20,7 +20,9 @@ class AddressReferenceBEFromBestAddress { private const RELEASE = 'https://gitea.champs-libres.be/api/v1/repos/Chill-project/belgian-bestaddresses-transform/releases/tags/v1.0.0'; - public function __construct(private readonly HttpClientInterface $client, private readonly AddressReferenceBaseImporter $baseImporter, private readonly AddressToReferenceMatcher $addressToReferenceMatcher) {} + public function __construct(private readonly HttpClientInterface $client, private readonly AddressReferenceBaseImporter $baseImporter, private readonly AddressToReferenceMatcher $addressToReferenceMatcher) + { + } public function import(string $lang, array $lists): void { diff --git a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php index bc656ebc5..1eaf42e76 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php +++ b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceBaseImporter.php @@ -45,7 +45,9 @@ final class AddressReferenceBaseImporter private array $waitingForInsert = []; - public function __construct(private readonly Connection $defaultConnection, private readonly LoggerInterface $logger) {} + public function __construct(private readonly Connection $defaultConnection, private readonly LoggerInterface $logger) + { + } public function finalize(): void { diff --git a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceFromBano.php b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceFromBano.php index ade89c6ff..a8b910424 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceFromBano.php +++ b/src/Bundle/ChillMainBundle/Service/Import/AddressReferenceFromBano.php @@ -17,7 +17,9 @@ use Symfony\Contracts\HttpClient\HttpClientInterface; class AddressReferenceFromBano { - public function __construct(private readonly HttpClientInterface $client, private readonly AddressReferenceBaseImporter $baseImporter, private readonly AddressToReferenceMatcher $addressToReferenceMatcher) {} + public function __construct(private readonly HttpClientInterface $client, private readonly AddressReferenceBaseImporter $baseImporter, private readonly AddressToReferenceMatcher $addressToReferenceMatcher) + { + } public function import(string $departementNo): void { @@ -58,7 +60,7 @@ class AddressReferenceFromBano foreach ($stmt as $record) { $this->baseImporter->importAddress( $record['refId'], - substr($record['refId'], 0, 5), // extract insee from reference + substr((string) $record['refId'], 0, 5), // extract insee from reference $record['postcode'], $record['street'], $record['streetNumber'], diff --git a/src/Bundle/ChillMainBundle/Service/Import/AddressToReferenceMatcher.php b/src/Bundle/ChillMainBundle/Service/Import/AddressToReferenceMatcher.php index 6a7bff632..32e8f0984 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/AddressToReferenceMatcher.php +++ b/src/Bundle/ChillMainBundle/Service/Import/AddressToReferenceMatcher.php @@ -64,7 +64,9 @@ final readonly class AddressToReferenceMatcher '{{ reviewed }}' => Address::ADDR_REFERENCE_STATUS_REVIEWED, ]; - public function __construct(private Connection $connection, private LoggerInterface $logger) {} + public function __construct(private Connection $connection, private LoggerInterface $logger) + { + } public function checkAddressesMatchingReferences(): void { diff --git a/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php b/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php index b76d6f096..6196f8fad 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php +++ b/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php @@ -43,7 +43,9 @@ final class GeographicalUnitBaseImporter private array $waitingForInsert = []; - public function __construct(private readonly Connection $defaultConnection, private readonly LoggerInterface $logger) {} + public function __construct(private readonly Connection $defaultConnection, private readonly LoggerInterface $logger) + { + } public function finalize(): void { diff --git a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php index a95ba1abc..2ac71abb7 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php +++ b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php @@ -20,7 +20,9 @@ class PostalCodeBEFromBestAddress { private const RELEASE = 'https://gitea.champs-libres.be/api/v1/repos/Chill-project/belgian-bestaddresses-transform/releases/tags/v1.0.0'; - public function __construct(private readonly PostalCodeBaseImporter $baseImporter, private readonly HttpClientInterface $client, private readonly LoggerInterface $logger) {} + public function __construct(private readonly PostalCodeBaseImporter $baseImporter, private readonly HttpClientInterface $client, private readonly LoggerInterface $logger) + { + } public function import(string $lang = 'fr'): void { diff --git a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php index a0fc5a5db..5f7f52d72 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php +++ b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBaseImporter.php @@ -54,7 +54,9 @@ class PostalCodeBaseImporter private array $waitingForInsert = []; - public function __construct(private readonly Connection $defaultConnection) {} + public function __construct(private readonly Connection $defaultConnection) + { + } public function finalize(): void { diff --git a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php index ee68e9d96..e5934af3b 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php +++ b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php @@ -23,9 +23,11 @@ use Symfony\Contracts\HttpClient\HttpClientInterface; */ class PostalCodeFRFromOpenData { - private const CSV = 'https://datanova.legroupe.laposte.fr/explore/dataset/laposte_hexasmal/download/?format=csv&timezone=Europe/Berlin&lang=fr&use_labels_for_header=true&csv_separator=%3B'; + private const CSV = 'https://datanova.laposte.fr/data-fair/api/v1/datasets/laposte-hexasmal/data-files/019HexaSmal.csv'; - public function __construct(private readonly PostalCodeBaseImporter $baseImporter, private readonly HttpClientInterface $client, private readonly LoggerInterface $logger) {} + public function __construct(private readonly PostalCodeBaseImporter $baseImporter, private readonly HttpClientInterface $client, private readonly LoggerInterface $logger) + { + } public function import(): void { diff --git a/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php b/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php index 4f2e88c08..b0bfae2b3 100644 --- a/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php +++ b/src/Bundle/ChillMainBundle/Service/Mailer/ChillMailer.php @@ -22,7 +22,9 @@ class ChillMailer implements MailerInterface { private string $prefix = '[Chill] '; - public function __construct(private readonly MailerInterface $initial, private readonly LoggerInterface $chillLogger) {} + public function __construct(private readonly MailerInterface $initial, private readonly LoggerInterface $chillLogger) + { + } public function send(RawMessage $message, Envelope $envelope = null): void { diff --git a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php index 445b35cb0..942310da4 100644 --- a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php +++ b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php @@ -69,7 +69,8 @@ class RollingDate private readonly string $roll, private readonly ?\DateTimeImmutable $fixedDate = null, private readonly \DateTimeImmutable $pivotDate = new \DateTimeImmutable('now') - ) {} + ) { + } public function getFixedDate(): ?\DateTimeImmutable { diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessage/NullShortMessageSender.php b/src/Bundle/ChillMainBundle/Service/ShortMessage/NullShortMessageSender.php index 16bc87790..82dea7bc6 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessage/NullShortMessageSender.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessage/NullShortMessageSender.php @@ -20,5 +20,7 @@ namespace Chill\MainBundle\Service\ShortMessage; class NullShortMessageSender implements ShortMessageSenderInterface { - public function send(ShortMessage $shortMessage): void {} + public function send(ShortMessage $shortMessage): void + { + } } diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessage.php b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessage.php index a2a5b6ed4..e028cf3c4 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessage.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessage.php @@ -26,7 +26,9 @@ class ShortMessage final public const PRIORITY_MEDIUM = 'medium'; - public function __construct(private string $content, private PhoneNumber $phoneNumber, private string $priority = 'low') {} + public function __construct(private string $content, private PhoneNumber $phoneNumber, private string $priority = 'low') + { + } public function getContent(): string { diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php index 344ff3c17..55490b2eb 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageHandler.php @@ -25,7 +25,9 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface; */ class ShortMessageHandler implements MessageHandlerInterface { - public function __construct(private readonly ShortMessageTransporterInterface $messageTransporter) {} + public function __construct(private readonly ShortMessageTransporterInterface $messageTransporter) + { + } public function __invoke(ShortMessage $message): void { diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageTransporter.php b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageTransporter.php index bbe4f0575..76e45acbd 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageTransporter.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessage/ShortMessageTransporter.php @@ -20,7 +20,9 @@ namespace Chill\MainBundle\Service\ShortMessage; class ShortMessageTransporter implements ShortMessageTransporterInterface { - public function __construct(private readonly ShortMessageSenderInterface $sender) {} + public function __construct(private readonly ShortMessageSenderInterface $sender) + { + } public function send(ShortMessage $shortMessage): void { diff --git a/src/Bundle/ChillMainBundle/Service/ShortMessageOvh/OvhShortMessageSender.php b/src/Bundle/ChillMainBundle/Service/ShortMessageOvh/OvhShortMessageSender.php index d81123c9a..bf43d76d4 100644 --- a/src/Bundle/ChillMainBundle/Service/ShortMessageOvh/OvhShortMessageSender.php +++ b/src/Bundle/ChillMainBundle/Service/ShortMessageOvh/OvhShortMessageSender.php @@ -36,7 +36,8 @@ class OvhShortMessageSender implements ShortMessageSenderInterface // for DI, must remains as third argument private readonly LoggerInterface $logger, private readonly PhoneNumberUtil $phoneNumberUtil - ) {} + ) { + } public function send(ShortMessage $shortMessage): void { diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php index f59b1cd66..8a4d99f82 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php @@ -30,7 +30,9 @@ class AddressRender implements ChillEntityRenderInterface 'extended_infos' => false, ]; - public function __construct(private readonly \Twig\Environment $templating, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} + public function __construct(private readonly \Twig\Environment $templating, private readonly TranslatableStringHelperInterface $translatableStringHelper) + { + } public function renderBox($addr, array $options): string { diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php index a4d0f48e6..80536c528 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php @@ -21,7 +21,9 @@ class CommentRender implements ChillEntityRenderInterface { use BoxUtilsChillEntityRenderTrait; - public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly \Twig\Environment $engine) {} + public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly \Twig\Environment $engine) + { + } public function renderBox($entity, array $options): string { diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php index 790996847..f246b0185 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php @@ -27,7 +27,9 @@ class UserRender implements ChillEntityRenderInterface 'at' => null, ]; - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly \Twig\Environment $engine, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly \Twig\Environment $engine, private readonly TranslatorInterface $translator) + { + } public function renderBox($entity, array $options): string { diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderGetActiveFilterHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderGetActiveFilterHelper.php index 4ca9eda41..ecc54acf6 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderGetActiveFilterHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderGetActiveFilterHelper.php @@ -22,7 +22,8 @@ final readonly class FilterOrderGetActiveFilterHelper private TranslatorInterface $translator, private PropertyAccessorInterface $propertyAccessor, private UserRender $userRender, - ) {} + ) { + } /** * Return all the data required to display the active filters. diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php index 9b6a42fe4..ebce380b0 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php @@ -51,7 +51,8 @@ final class FilterOrderHelper public function __construct( private readonly FormFactoryInterface $formFactory, private readonly RequestStack $requestStack, - ) {} + ) { + } public function addSingleCheckbox(string $name, string $label): self { diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php index d5df6d4f3..4bef35046 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php @@ -37,7 +37,9 @@ class FilterOrderHelperBuilder */ private array $userPickers = []; - public function __construct(private readonly FormFactoryInterface $formFactory, private readonly RequestStack $requestStack) {} + public function __construct(private readonly FormFactoryInterface $formFactory, private readonly RequestStack $requestStack) + { + } public function addSingleCheckbox(string $name, string $label): self { diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php index 0aff466dc..c9c094a15 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php @@ -16,7 +16,9 @@ use Symfony\Component\HttpFoundation\RequestStack; class FilterOrderHelperFactory implements FilterOrderHelperFactoryInterface { - public function __construct(private readonly FormFactoryInterface $formFactory, private readonly RequestStack $requestStack) {} + public function __construct(private readonly FormFactoryInterface $formFactory, private readonly RequestStack $requestStack) + { + } public function create(string $context, ?array $options = []): FilterOrderHelperBuilder { diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php b/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php index 6d91cdd83..40eca8679 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php @@ -25,7 +25,8 @@ class Templating extends AbstractExtension public function __construct( private readonly RequestStack $requestStack, private readonly FilterOrderGetActiveFilterHelper $filterOrderGetActiveFilterHelper, - ) {} + ) { + } public function getFilters(): array { diff --git a/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php b/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php index eceae8d9c..bdcc1d9d9 100644 --- a/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php +++ b/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php @@ -22,7 +22,9 @@ class TranslatableStringTwig extends AbstractExtension /** * TranslatableStringTwig constructor. */ - public function __construct(private readonly TranslatableStringHelper $helper) {} + public function __construct(private readonly TranslatableStringHelper $helper) + { + } /** * Returns a list of filters to add to the existing list. diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/GeographicalUnitByAddressApiControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/GeographicalUnitByAddressApiControllerTest.php index cf8fabf66..f47ddd40b 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/GeographicalUnitByAddressApiControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/GeographicalUnitByAddressApiControllerTest.php @@ -43,7 +43,7 @@ class GeographicalUnitByAddressApiControllerTest extends WebTestCase $em = self::$container->get(EntityManagerInterface::class); $nb = $em->createQuery('SELECT COUNT(a) FROM '.Address::class.' a')->getSingleScalarResult(); - /** @var \Chill\MainBundle\Entity\Address $random */ + /** @var Address $random */ $random = $em->createQuery('SELECT a FROM '.Address::class.' a') ->setFirstResult(random_int(0, $nb)) ->setMaxResults(1) diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/UserProfileControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/UserProfileControllerTest.php new file mode 100644 index 000000000..fd7fd6028 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Tests/Controller/UserProfileControllerTest.php @@ -0,0 +1,33 @@ +getClientAuthenticated(); + + $client->request('GET', '/fr/main/user/my-profile'); + $this->assertResponseIsSuccessful('Request GET /main/user/my-profile was successful'); + } +} diff --git a/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php index cec60c7c9..489bab4cb 100644 --- a/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Cron/CronManagerTest.php @@ -161,7 +161,9 @@ final class CronManagerTest extends TestCase class JobCanRun implements CronJobInterface { - public function __construct(private readonly string $key) {} + public function __construct(private readonly string $key) + { + } public function canRun(?CronJobExecution $cronJobExecution): bool { diff --git a/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php index b9e597ec0..44091f38b 100644 --- a/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php @@ -58,7 +58,7 @@ final class ExportManagerTest extends KernelTestCase { self::bootKernel(); - $this->prophet = new \Prophecy\Prophet(); + $this->prophet = new Prophet(); } protected function tearDown(): void @@ -370,7 +370,7 @@ final class ExportManagerTest extends KernelTestCase $user = $this->prepareUser([]); $authorizationChecker = $this->prophet->prophesize(); - $authorizationChecker->willImplement(\Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface::class); + $authorizationChecker->willImplement(AuthorizationCheckerInterface::class); $authorizationChecker->isGranted('CHILL_STAT_DUMMY', $center) ->willReturn(true); @@ -399,7 +399,7 @@ final class ExportManagerTest extends KernelTestCase $user = $this->prepareUser([]); $authorizationChecker = $this->prophet->prophesize(); - $authorizationChecker->willImplement(\Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface::class); + $authorizationChecker->willImplement(AuthorizationCheckerInterface::class); $authorizationChecker->isGranted('CHILL_STAT_DUMMY', $center) ->willReturn(true); $authorizationChecker->isGranted('CHILL_STAT_DUMMY', $centerB) @@ -435,7 +435,7 @@ final class ExportManagerTest extends KernelTestCase ); $export = $this->prophet->prophesize(); - $export->willImplement(\Chill\MainBundle\Export\ExportInterface::class); + $export->willImplement(ExportInterface::class); $export->requiredRole()->willReturn('CHILL_STAT_DUMMY'); $result = $exportManager->isGrantedForElement($export->reveal(), null, []); @@ -532,14 +532,17 @@ class DummyFilterWithApplying implements FilterInterface public function __construct( private readonly ?string $role, private readonly string $applyOn - ) {} + ) { + } public function getTitle() { return 'dummy'; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { @@ -556,7 +559,9 @@ class DummyFilterWithApplying implements FilterInterface return $this->role; } - public function alterQuery(QueryBuilder $qb, $data) {} + public function alterQuery(QueryBuilder $qb, $data) + { + } public function applyOn() { @@ -572,14 +577,17 @@ class DummyExport implements ExportInterface * @var array */ private readonly array $supportedModifiers, - ) {} + ) { + } public function getTitle() { return 'dummy'; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php b/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php index e7dbaf8fb..d7fdc49c8 100644 --- a/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php @@ -117,9 +117,13 @@ class SortExportElementTest extends KernelTestCase private function makeAggregator(string $title): AggregatorInterface { return new class ($title) implements AggregatorInterface { - public function __construct(private readonly string $title) {} + public function __construct(private readonly string $title) + { + } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { @@ -146,7 +150,9 @@ class SortExportElementTest extends KernelTestCase return null; } - public function alterQuery(QueryBuilder $qb, $data) {} + public function alterQuery(QueryBuilder $qb, $data) + { + } public function applyOn() { @@ -158,14 +164,18 @@ class SortExportElementTest extends KernelTestCase private function makeFilter(string $title): FilterInterface { return new class ($title) implements FilterInterface { - public function __construct(private readonly string $title) {} + public function __construct(private readonly string $title) + { + } public function getTitle() { return $this->title; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { @@ -182,7 +192,9 @@ class SortExportElementTest extends KernelTestCase return null; } - public function alterQuery(QueryBuilder $qb, $data) {} + public function alterQuery(QueryBuilder $qb, $data) + { + } public function applyOn() { diff --git a/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php b/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php index e74888b83..d21c7d50a 100644 --- a/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php @@ -258,8 +258,8 @@ final class AuthorizationHelperTest extends KernelTestCase ]); $helper = $this->getAuthorizationHelper(); $entity = $this->prophesize(); - $entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class); - $entity->willImplement('\\'.\Chill\MainBundle\Entity\HasScopeInterface::class); + $entity->willImplement('\\'.HasCenterInterface::class); + $entity->willImplement('\\'.HasScopeInterface::class); $entity->getCenter()->willReturn($center); $entity->getScope()->willReturn($scope); @@ -383,7 +383,7 @@ final class AuthorizationHelperTest extends KernelTestCase ]); $helper = $this->getAuthorizationHelper(); $entity = $this->prophesize(); - $entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class); + $entity->willImplement('\\'.HasCenterInterface::class); $entity->getCenter()->willReturn($center); $this->assertTrue($helper->userHasAccess( @@ -407,7 +407,7 @@ final class AuthorizationHelperTest extends KernelTestCase $helper = $this->getAuthorizationHelper(); $entity = $this->prophesize(); - $entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class); + $entity->willImplement('\\'.HasCenterInterface::class); $entity->getCenter()->willReturn($center); $this->assertTrue($helper->userHasAccess( @@ -431,8 +431,8 @@ final class AuthorizationHelperTest extends KernelTestCase ]); $helper = $this->getAuthorizationHelper(); $entity = $this->prophesize(); - $entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class); - $entity->willImplement('\\'.\Chill\MainBundle\Entity\HasScopeInterface::class); + $entity->willImplement('\\'.HasCenterInterface::class); + $entity->willImplement('\\'.HasScopeInterface::class); $entity->getCenter()->willReturn($centerB); $entity->getScope()->willReturn($scope); @@ -452,7 +452,7 @@ final class AuthorizationHelperTest extends KernelTestCase ]); $helper = $this->getAuthorizationHelper(); $entity = $this->prophesize(); - $entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class); + $entity->willImplement('\\'.HasCenterInterface::class); $entity->getCenter()->willReturn($center); $this->assertFalse($helper->userHasAccess($user, $entity->reveal(), 'CHILL_ROLE')); @@ -471,8 +471,8 @@ final class AuthorizationHelperTest extends KernelTestCase ]); $helper = $this->getAuthorizationHelper(); $entity = $this->prophesize(); - $entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class); - $entity->willImplement('\\'.\Chill\MainBundle\Entity\HasScopeInterface::class); + $entity->willImplement('\\'.HasCenterInterface::class); + $entity->willImplement('\\'.HasScopeInterface::class); $entity->getCenter()->willReturn($center); $entity->getScope()->willReturn($scope); @@ -503,7 +503,7 @@ final class AuthorizationHelperTest extends KernelTestCase ]); $helper = $this->getAuthorizationHelper(); $entity = $this->prophesize(); - $entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class); + $entity->willImplement('\\'.HasCenterInterface::class); $entity->getCenter()->willReturn($centerA); $this->assertFalse($helper->userHasAccess($user, $entity->reveal(), 'CHILL_ROLE')); @@ -577,7 +577,7 @@ final class AuthorizationHelperTest extends KernelTestCase } /** - * @return \Chill\MainBundle\Security\Authorization\AuthorizationHelper + * @return AuthorizationHelper */ private function getAuthorizationHelper() { diff --git a/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php index 78956a1d9..b2481917e 100644 --- a/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php @@ -34,7 +34,9 @@ final class TokenManagerTest extends KernelTestCase $this->tokenManager = new TokenManager('secret', $logger); } - public static function setUpBefore() {} + public static function setUpBefore() + { + } public function testGenerate() { diff --git a/src/Bundle/ChillMainBundle/Tests/Security/Resolver/DefaultScopeResolverTest.php b/src/Bundle/ChillMainBundle/Tests/Security/Resolver/DefaultScopeResolverTest.php index 733e17fec..1ec23fdb3 100644 --- a/src/Bundle/ChillMainBundle/Tests/Security/Resolver/DefaultScopeResolverTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Security/Resolver/DefaultScopeResolverTest.php @@ -35,7 +35,9 @@ final class DefaultScopeResolverTest extends TestCase { $scope = new Scope(); $entity = new class ($scope) implements HasScopeInterface { - public function __construct(private readonly Scope $scope) {} + public function __construct(private readonly Scope $scope) + { + } public function getScope() { @@ -51,7 +53,9 @@ final class DefaultScopeResolverTest extends TestCase public function testHasScopesInterface() { $entity = new class ($scopeA = new Scope(), $scopeB = new Scope()) implements HasScopesInterface { - public function __construct(private readonly Scope $scopeA, private readonly Scope $scopeB) {} + public function __construct(private readonly Scope $scopeA, private readonly Scope $scopeB) + { + } public function getScopes(): iterable { diff --git a/src/Bundle/ChillMainBundle/Tests/Security/Resolver/ScopeResolverDispatcherTest.php b/src/Bundle/ChillMainBundle/Tests/Security/Resolver/ScopeResolverDispatcherTest.php index 35245174c..dd4b7f121 100644 --- a/src/Bundle/ChillMainBundle/Tests/Security/Resolver/ScopeResolverDispatcherTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Security/Resolver/ScopeResolverDispatcherTest.php @@ -36,7 +36,9 @@ final class ScopeResolverDispatcherTest extends TestCase { $scope = new Scope(); $entity = new class ($scope) implements HasScopeInterface { - public function __construct(private readonly Scope $scope) {} + public function __construct(private readonly Scope $scope) + { + } public function getScope() { diff --git a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php new file mode 100644 index 000000000..123f1c3ae --- /dev/null +++ b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php @@ -0,0 +1,140 @@ +setUsername('SomeUser') + ->setLabel('SomeUser') + ->setPhonenumber(PhoneNumberUtil::getInstance()->parse('+32475928635')) + ->setEmail('some.user@chill.com'); + + $userNoPhone + ->setUsername('AnotherUser') + ->setLabel('AnotherUser'); + + yield [$user, 'docgen', ['docgen:expects' => User::class], + [ + 'id' => $user->getId(), // id + 'type' => 'user', // type + 'username' => 'SomeUser', // username + 'email' => 'some.user@chill.com', // email + 'text' => 'SomeUser', // text + 'label' => 'SomeUser', // label + 'phonenumber' => ['context' => PhoneNumber::class], // phonenumber + 'main_scope' => ['context' => Scope::class], // scope + 'user_job' => ['context' => UserJob::class], // user job + 'current_location' => ['context' => Location::class], // curent location + 'main_location' => ['context' => Location::class], // main location + 'civility' => ['context' => Civility::class], // civility + 'text_without_absent' => 'SomeUser', + 'isAbsent' => false, + 'main_center' => ['context' => Center::class], + ]]; + + yield [$userNoPhone, 'docgen', ['docgen:expects' => User::class], + [ + 'id' => $user->getId(), // id + 'type' => 'user', // type + 'username' => 'AnotherUser', // username + 'email' => '', // email + 'text' => 'AnotherUser', // text + 'label' => 'AnotherUser', // label + 'phonenumber' => ['context' => PhoneNumber::class], // phonenumber + 'main_scope' => ['context' => Scope::class], // scope + 'user_job' => ['context' => UserJob::class], // user job + 'current_location' => ['context' => Location::class], // curent location + 'main_location' => ['context' => Location::class], // main location + 'civility' => ['context' => Civility::class], // civility + 'text_without_absent' => 'AnotherUser', + 'isAbsent' => false, + 'main_center' => ['context' => Center::class], + ]]; + + yield [null, 'docgen', ['docgen:expects' => User::class], [ + 'id' => '', // id + 'type' => 'user', // type + 'username' => '', // username + 'email' => '', // email + 'text' => '', // text + 'label' => '', // label + 'phonenumber' => ['context' => PhoneNumber::class], // phonenumber + 'main_scope' => ['context' => Scope::class], // scope + 'user_job' => ['context' => UserJob::class], // user job + 'current_location' => ['context' => Location::class], // curent location + 'main_location' => ['context' => Location::class], // main location + 'civility' => ['context' => Civility::class], // civility + 'text_without_absent' => '', + 'isAbsent' => false, + 'main_center' => ['context' => Center::class], + ]]; + } + + /** + * @dataProvider dataProviderUserNormalizer + * + * @throws ExceptionInterface + */ + public function testNormalize(null|User $user, mixed $format, mixed $context, mixed $expected) + { + $userRender = $this->prophesize(UserRender::class); + $userRender->renderString(Argument::type(User::class), Argument::type('array'))->willReturn($user ? $user->getLabel() : ''); + + $normalizer = new UserNormalizer($userRender->reveal()); + $normalizer->setNormalizer(new class () implements NormalizerInterface { + public function normalize($object, string $format = null, array $context = []) + { + return ['context' => $context['docgen:expects'] ?? null]; + } + + public function supportsNormalization($data, string $format = null) + { + return true; + } + }); + + $this->assertEquals($expected, $normalizer->normalize($user, $format, $context)); + } +} diff --git a/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php b/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php index 53d8faa16..6b4253104 100644 --- a/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php +++ b/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php @@ -37,7 +37,9 @@ class TimelineBuilder */ private array $providersByContext = []; - public function __construct(private readonly EntityManagerInterface $em, private readonly Environment $twig) {} + public function __construct(private readonly EntityManagerInterface $em, private readonly Environment $twig) + { + } /** * add a provider id. diff --git a/src/Bundle/ChillMainBundle/Timeline/TimelineSingleQuery.php b/src/Bundle/ChillMainBundle/Timeline/TimelineSingleQuery.php index 584e634ea..e736ba749 100644 --- a/src/Bundle/ChillMainBundle/Timeline/TimelineSingleQuery.php +++ b/src/Bundle/ChillMainBundle/Timeline/TimelineSingleQuery.php @@ -15,7 +15,9 @@ class TimelineSingleQuery { private bool $distinct = false; - public function __construct(private ?string $id = null, private ?string $date = null, private ?string $key = null, private ?string $from = null, private ?string $where = null, private array $parameters = []) {} + public function __construct(private ?string $id = null, private ?string $date = null, private ?string $key = null, private ?string $from = null, private ?string $where = null, private array $parameters = []) + { + } public function buildSql(): string { diff --git a/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php b/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php index 0bbf1d373..8980b8376 100644 --- a/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php +++ b/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php @@ -21,7 +21,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class RoleScopeScopePresence extends ConstraintValidator { - public function __construct(private readonly RoleProvider $roleProvider, private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly RoleProvider $roleProvider, private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator) + { + } public function validate($value, Constraint $constraint) { diff --git a/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php b/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php index 0c02885ad..f0fd1880c 100644 --- a/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php +++ b/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php @@ -18,7 +18,9 @@ use Symfony\Component\Validator\ConstraintValidator; final class ValidPhonenumber extends ConstraintValidator { - public function __construct(private readonly LoggerInterface $logger, private readonly PhoneNumberHelperInterface $phonenumberHelper) {} + public function __construct(private readonly LoggerInterface $logger, private readonly PhoneNumberHelperInterface $phonenumberHelper) + { + } /** * @param string $value diff --git a/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php b/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php index a1b631265..3ea5d495b 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php +++ b/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php @@ -22,7 +22,9 @@ use Symfony\Component\Workflow\Event\Event; final readonly class WorkflowByUserCounter implements NotificationCounterInterface, EventSubscriberInterface { - public function __construct(private EntityWorkflowStepRepository $workflowStepRepository, private CacheItemPoolInterface $cacheItemPool) {} + public function __construct(private EntityWorkflowStepRepository $workflowStepRepository, private CacheItemPoolInterface $cacheItemPool) + { + } public function addNotification(UserInterface $u): int { diff --git a/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowManager.php b/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowManager.php index 9a1f52280..6c45cef3d 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowManager.php +++ b/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowManager.php @@ -20,7 +20,9 @@ class EntityWorkflowManager /** * @param \Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface[] $handlers */ - public function __construct(private readonly iterable $handlers, private readonly Registry $registry) {} + public function __construct(private readonly iterable $handlers, private readonly Registry $registry) + { + } public function getHandler(EntityWorkflow $entityWorkflow, array $options = []): EntityWorkflowHandlerInterface { diff --git a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/EntityWorkflowTransitionEventSubscriber.php b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/EntityWorkflowTransitionEventSubscriber.php index b1fa80458..804a6587f 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/EntityWorkflowTransitionEventSubscriber.php +++ b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/EntityWorkflowTransitionEventSubscriber.php @@ -23,7 +23,9 @@ use Symfony\Component\Workflow\TransitionBlocker; class EntityWorkflowTransitionEventSubscriber implements EventSubscriberInterface { - public function __construct(private readonly LoggerInterface $chillLogger, private readonly Security $security, private readonly UserRender $userRender) {} + public function __construct(private readonly LoggerInterface $chillLogger, private readonly Security $security, private readonly UserRender $userRender) + { + } public function addDests(Event $event): void { diff --git a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php index e290a567e..07cf8cc14 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php +++ b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php @@ -23,7 +23,9 @@ use Symfony\Component\Workflow\Registry; class NotificationOnTransition implements EventSubscriberInterface { - public function __construct(private readonly EntityManagerInterface $entityManager, private readonly \Twig\Environment $engine, private readonly MetadataExtractor $metadataExtractor, private readonly Security $security, private readonly Registry $registry) {} + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly \Twig\Environment $engine, private readonly MetadataExtractor $metadataExtractor, private readonly Security $security, private readonly Registry $registry) + { + } public static function getSubscribedEvents(): array { diff --git a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php index 90a6e19db..bd07a5a28 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php +++ b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/SendAccessKeyEventSubscriber.php @@ -20,7 +20,9 @@ use Symfony\Component\Workflow\Registry; class SendAccessKeyEventSubscriber { - public function __construct(private readonly \Twig\Environment $engine, private readonly MetadataExtractor $metadataExtractor, private readonly Registry $registry, private readonly EntityWorkflowManager $entityWorkflowManager, private readonly MailerInterface $mailer) {} + public function __construct(private readonly \Twig\Environment $engine, private readonly MetadataExtractor $metadataExtractor, private readonly Registry $registry, private readonly EntityWorkflowManager $entityWorkflowManager, private readonly MailerInterface $mailer) + { + } public function postPersist(EntityWorkflowStep $step): void { diff --git a/src/Bundle/ChillMainBundle/Workflow/Exception/HandlerNotFoundException.php b/src/Bundle/ChillMainBundle/Workflow/Exception/HandlerNotFoundException.php index 9d91b3357..f4280b50f 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Exception/HandlerNotFoundException.php +++ b/src/Bundle/ChillMainBundle/Workflow/Exception/HandlerNotFoundException.php @@ -11,4 +11,6 @@ declare(strict_types=1); namespace Chill\MainBundle\Workflow\Exception; -class HandlerNotFoundException extends \RuntimeException {} +class HandlerNotFoundException extends \RuntimeException +{ +} diff --git a/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php b/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php index dabe0cf8e..05ee58d87 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php +++ b/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php @@ -19,7 +19,9 @@ use Symfony\Component\Workflow\WorkflowInterface; class MetadataExtractor { - public function __construct(private readonly Registry $registry, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} + public function __construct(private readonly Registry $registry, private readonly TranslatableStringHelperInterface $translatableStringHelper) + { + } public function availableWorkflowFor(string $relatedEntityClass, ?int $relatedEntityId = 0): array { diff --git a/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php b/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php index c9ba7cf79..9302cf7f9 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php +++ b/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php @@ -20,7 +20,9 @@ use Symfony\Component\Security\Core\Security; class WorkflowNotificationHandler implements NotificationHandlerInterface { - public function __construct(private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly EntityWorkflowManager $entityWorkflowManager, private readonly Security $security) {} + public function __construct(private readonly EntityWorkflowRepository $entityWorkflowRepository, private readonly EntityWorkflowManager $entityWorkflowManager, private readonly Security $security) + { + } public function getTemplate(Notification $notification, array $options = []): string { diff --git a/src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtensionRuntime.php b/src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtensionRuntime.php index f2b7d80db..e9edb11d9 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtensionRuntime.php +++ b/src/Bundle/ChillMainBundle/Workflow/Templating/WorkflowTwigExtensionRuntime.php @@ -23,7 +23,9 @@ use Twig\Extension\RuntimeExtensionInterface; class WorkflowTwigExtensionRuntime implements RuntimeExtensionInterface { - public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly Registry $registry, private readonly EntityWorkflowRepository $repository, private readonly MetadataExtractor $metadataExtractor, private readonly NormalizerInterface $normalizer) {} + public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly Registry $registry, private readonly EntityWorkflowRepository $repository, private readonly MetadataExtractor $metadataExtractor, private readonly NormalizerInterface $normalizer) + { + } public function getTransitionByString(EntityWorkflow $entityWorkflow, string $key): ?Transition { diff --git a/src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreationValidator.php b/src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreationValidator.php index 2020c7b52..f6590c9d3 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreationValidator.php +++ b/src/Bundle/ChillMainBundle/Workflow/Validator/EntityWorkflowCreationValidator.php @@ -21,7 +21,9 @@ use Symfony\Component\Workflow\WorkflowInterface; class EntityWorkflowCreationValidator extends \Symfony\Component\Validator\ConstraintValidator { - public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager) {} + public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager) + { + } /** * @param EntityWorkflow $value diff --git a/src/Bundle/ChillMainBundle/migrations/Version20100000000000.php b/src/Bundle/ChillMainBundle/migrations/Version20100000000000.php index 55f5a6420..5ae675b51 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20100000000000.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20100000000000.php @@ -16,7 +16,9 @@ use Doctrine\Migrations\AbstractMigration; class Version20100000000000 extends AbstractMigration { - public function down(Schema $schema): void {} + public function down(Schema $schema): void + { + } public function up(Schema $schema): void { diff --git a/src/Bundle/ChillMainBundle/migrations/Version20220513151853.php b/src/Bundle/ChillMainBundle/migrations/Version20220513151853.php index 4bd9bd18f..c46b40ee5 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20220513151853.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20220513151853.php @@ -16,7 +16,9 @@ use Doctrine\Migrations\AbstractMigration; final class Version20220513151853 extends AbstractMigration { - public function down(Schema $schema): void {} + public function down(Schema $schema): void + { + } public function getDescription(): string { diff --git a/src/Bundle/ChillMainBundle/migrations/Version20231020075524.php b/src/Bundle/ChillMainBundle/migrations/Version20231020075524.php new file mode 100644 index 000000000..5ae44d9bd --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20231020075524.php @@ -0,0 +1,37 @@ +addSql('ALTER TABLE users ADD phonenumber VARCHAR(35) DEFAULT NULL'); + $this->addSql('COMMENT ON COLUMN users.phonenumber IS \'(DC2Type:phone_number)\''); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE users DROP phonenumber'); + } +} diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index cca4e82d0..c2b795a38 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -44,6 +44,13 @@ address_fields: Données liées à l'adresse Datas: Données No title: Aucun titre +user: + profile: + title: Mon profil + Phonenumber successfully updated!: Numéro de téléphone mis à jour! + no job: Pas de métier assigné + no scope: Pas de cercle assigné + inactive: inactif Edit: Modifier diff --git a/src/Bundle/ChillMainBundle/translations/messages.nl.yml b/src/Bundle/ChillMainBundle/translations/messages.nl.yml index 2e4ee5a88..cd6cbc6a4 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.nl.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.nl.yml @@ -39,6 +39,13 @@ Last updated by: Laatste update door on: "op " Last updated on: Laatste update op by_user: "door " +lifecycleUpdate: Updates en creatie gebeurtenissen +address_fields: Gegevens gelinked aan het adres +Datas: Gegevens +No title: Geen titel +User profile: Mijn gebruikersprofiel +Phonenumber successfully updated!: Telefoonnummer bijgewerkt! + Edit: Bewerken Update: Updaten diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php index 64d2b8f12..f65533958 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php @@ -22,7 +22,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class PersonAddressMoveEventSubscriber implements EventSubscriberInterface { - public function __construct(private readonly \Twig\Environment $engine, private readonly NotificationPersisterInterface $notificationPersister, private readonly Security $security, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly \Twig\Environment $engine, private readonly NotificationPersisterInterface $notificationPersister, private readonly Security $security, private readonly TranslatorInterface $translator) + { + } public static function getSubscribedEvents(): array { diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php index 084fe8ff5..297da8673 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php @@ -23,7 +23,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UserRefEventSubscriber implements EventSubscriberInterface { - public function __construct(private readonly Security $security, private readonly TranslatorInterface $translator, private readonly \Twig\Environment $engine, private readonly NotificationPersisterInterface $notificationPersister) {} + public function __construct(private readonly Security $security, private readonly TranslatorInterface $translator, private readonly \Twig\Environment $engine, private readonly NotificationPersisterInterface $notificationPersister) + { + } public static function getSubscribedEvents() { diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjob.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjob.php index 0d362c581..2ddf3415c 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjob.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeCronjob.php @@ -20,7 +20,8 @@ readonly class AccompanyingPeriodStepChangeCronjob implements CronJobInterface public function __construct( private ClockInterface $clock, private AccompanyingPeriodStepChangeRequestor $requestor, - ) {} + ) { + } public function canRun(?CronJobExecution $cronJobExecution): bool { diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeMessageHandler.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeMessageHandler.php index 534672efc..71d28c57f 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeMessageHandler.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChangeMessageHandler.php @@ -23,7 +23,8 @@ class AccompanyingPeriodStepChangeMessageHandler implements MessageHandlerInterf public function __construct( private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly AccompanyingPeriodStepChanger $changer, - ) {} + ) { + } public function __invoke(AccompanyingPeriodStepChangeRequestMessage $message): void { diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChanger.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChanger.php index 25a739ce0..b0fe4c5b2 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChanger.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Lifecycle/AccompanyingPeriodStepChanger.php @@ -30,7 +30,8 @@ class AccompanyingPeriodStepChanger private readonly EntityManagerInterface $entityManager, private readonly LoggerInterface $logger, private readonly Registry $workflowRegistry, - ) {} + ) { + } public function __invoke(AccompanyingPeriod $period, string $transition, string $workflowName = null): void { diff --git a/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php b/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php index ac3363db0..465807ebd 100644 --- a/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php +++ b/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php @@ -52,7 +52,8 @@ class ActionEvent extends \Symfony\Contracts\EventDispatcher\Event * an array of key value data to describe the movement. */ protected $metadata = [] - ) {} + ) { + } /** * Add Sql which will be executed **after** the delete statement. diff --git a/src/Bundle/ChillPersonBundle/Actions/Remove/Handler/PersonMoveAccompanyingPeriodParticipationHandler.php b/src/Bundle/ChillPersonBundle/Actions/Remove/Handler/PersonMoveAccompanyingPeriodParticipationHandler.php index 2c342a9a5..3cff98292 100644 --- a/src/Bundle/ChillPersonBundle/Actions/Remove/Handler/PersonMoveAccompanyingPeriodParticipationHandler.php +++ b/src/Bundle/ChillPersonBundle/Actions/Remove/Handler/PersonMoveAccompanyingPeriodParticipationHandler.php @@ -26,7 +26,7 @@ class PersonMoveAccompanyingPeriodParticipationHandler implements PersonMoveSqlH { $insertSql = sprintf(<<<'SQL' INSERT INTO chill_person_accompanying_period_participation (person_id, accompanyingperiod_id, id, startdate, enddate) - SELECT %d, accompanyingperiod_id, nextval('chill_person_accompanying_period_id_seq'), startdate, enddate + SELECT %d, accompanyingperiod_id, nextval('chill_person_accompanying_period_participation_id_seq'), startdate, enddate FROM chill_person_accompanying_period_participation cpapp WHERE person_id = %d AND NOT EXISTS ( diff --git a/src/Bundle/ChillPersonBundle/Actions/Remove/Handler/PersonMoveCenterHistoryHandler.php b/src/Bundle/ChillPersonBundle/Actions/Remove/Handler/PersonMoveCenterHistoryHandler.php index f08bd7dff..b2deb17ca 100644 --- a/src/Bundle/ChillPersonBundle/Actions/Remove/Handler/PersonMoveCenterHistoryHandler.php +++ b/src/Bundle/ChillPersonBundle/Actions/Remove/Handler/PersonMoveCenterHistoryHandler.php @@ -19,7 +19,8 @@ class PersonMoveCenterHistoryHandler implements PersonMoveSqlHandlerInterface { public function __construct( private readonly PersonCenterHistoryRepository $centerHistoryRepository, - ) {} + ) { + } public function supports(string $className, string $field): bool { diff --git a/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php b/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php index 292c805a0..48fa57b85 100644 --- a/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php +++ b/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php @@ -33,7 +33,8 @@ class PersonMove private readonly EntityManagerInterface $em, private readonly PersonMoveManager $personMoveManager, private readonly EventDispatcherInterface $eventDispatcher - ) {} + ) { + } /** * Return the sql used to move or delete entities associated to a person to diff --git a/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMoveManager.php b/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMoveManager.php index 0c9230d90..230c2d4e2 100644 --- a/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMoveManager.php +++ b/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMoveManager.php @@ -20,7 +20,8 @@ class PersonMoveManager * @var iterable */ private readonly iterable $handlers, - ) {} + ) { + } /** * @param class-string $className diff --git a/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php b/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php index 3f233c174..d91c38f78 100644 --- a/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php +++ b/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php @@ -24,7 +24,8 @@ class ConfigPersonAltNamesHelper * the raw config, directly from the container parameter. */ private $config - ) {} + ) { + } /** * get the choices as key => values. diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php index 7819ebb46..8efe73d92 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php @@ -46,7 +46,9 @@ use Symfony\Component\Workflow\Registry; final class AccompanyingCourseApiController extends ApiController { - public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository, private readonly EventDispatcherInterface $eventDispatcher, private readonly ReferralsSuggestionInterface $referralAvailable, private readonly Registry $registry, private readonly ValidatorInterface $validator) {} + public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository, private readonly EventDispatcherInterface $eventDispatcher, private readonly ReferralsSuggestionInterface $referralAvailable, private readonly Registry $registry, private readonly ValidatorInterface $validator) + { + } public function commentApi($id, Request $request, string $_format): Response { diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php index 895011085..48e0e2cfa 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php @@ -30,7 +30,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingCourseCommentController extends AbstractController { - public function __construct(private readonly EntityManagerInterface $entityManager, private readonly FormFactoryInterface $formFactory, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly FormFactoryInterface $formFactory, private readonly TranslatorInterface $translator) + { + } /** * Page of comments in Accompanying Course section. diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php index af4da0bae..a2ced7fee 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -37,7 +37,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController { - public function __construct(protected SerializerInterface $serializer, protected EventDispatcherInterface $dispatcher, protected ValidatorInterface $validator, private readonly AccompanyingPeriodWorkRepository $workRepository, private readonly Registry $registry, private readonly TranslatorInterface $translator) {} + public function __construct(protected SerializerInterface $serializer, protected EventDispatcherInterface $dispatcher, protected ValidatorInterface $validator, private readonly AccompanyingPeriodWorkRepository $workRepository, private readonly Registry $registry, private readonly TranslatorInterface $translator) + { + } /** * @Route("/{_locale}/parcours/{accompanying_period_id}/close", name="chill_person_accompanying_course_close") diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php index 2a9e4e9da..47e46cb6b 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php @@ -21,7 +21,9 @@ use Symfony\Component\Routing\Annotation\Route; class AccompanyingCourseWorkApiController extends ApiController { - public function __construct(private readonly AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository) {} + public function __construct(private readonly AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository) + { + } /** * @Route("/api/1.0/person/accompanying-period/work/my-near-end") diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php index 89ec1ae17..5ae2db0e3 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php @@ -41,7 +41,8 @@ final class AccompanyingCourseWorkController extends AbstractController private readonly LoggerInterface $chillLogger, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory - ) {} + ) { + } /** * @Route( @@ -223,7 +224,7 @@ final class AccompanyingCourseWorkController extends AbstractController if (1 < count($types)) { $filterBuilder - ->addEntityChoice('typesFilter', 'accompanying_course_work.types_filter', \Chill\PersonBundle\Entity\SocialWork\SocialAction::class, $types, [ + ->addEntityChoice('typesFilter', 'accompanying_course_work.types_filter', SocialAction::class, $types, [ 'choice_label' => fn (SocialAction $sa) => $this->translatableStringHelper->localize($sa->getTitle()), ]); } diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php index 21378b9d7..5855692f1 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php @@ -20,7 +20,9 @@ use Symfony\Component\Security\Core\Security; class AccompanyingCourseWorkEvaluationDocumentController extends AbstractController { - public function __construct(private readonly Security $security) {} + public function __construct(private readonly Security $security) + { + } /** * @Route( diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php index 55b985b85..e515dc57e 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php @@ -39,7 +39,8 @@ class AccompanyingPeriodController extends AbstractController private readonly EventDispatcherInterface $eventDispatcher, private readonly ValidatorInterface $validator, private readonly TranslatorInterface $translator - ) {} + ) { + } /** * @throws \Exception @@ -431,7 +432,7 @@ class AccompanyingPeriodController extends AbstractController private function _getPerson(int $id): Person { $person = $this->getDoctrine()->getManager() - ->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($id); + ->getRepository(Person::class)->find($id); if (null === $person) { throw $this->createNotFoundException('Person not found'); diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php index f5516114f..0c81e21b9 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php @@ -31,7 +31,9 @@ use Symfony\Component\Security\Core\Security; class AccompanyingPeriodRegulationListController { - public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} + public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly TranslatableStringHelperInterface $translatableStringHelper) + { + } /** * @Route("/{_locale}/person/periods/undispatched", name="chill_person_course_list_regulation") diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php index 60b8e9cff..aa9a265e2 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php @@ -29,7 +29,9 @@ use Symfony\Component\Serializer\SerializerInterface; class AccompanyingPeriodWorkEvaluationApiController { - public function __construct(private readonly AccompanyingPeriodWorkEvaluationRepository $accompanyingPeriodWorkEvaluationRepository, private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly SerializerInterface $serializer, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security) {} + public function __construct(private readonly AccompanyingPeriodWorkEvaluationRepository $accompanyingPeriodWorkEvaluationRepository, private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly SerializerInterface $serializer, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security) + { + } /** * @Route("/api/1.0/person/docgen/template/by-evaluation/{id}.{_format}", diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php index a5b1081d5..cea622fab 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php @@ -31,7 +31,9 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; class HouseholdApiController extends ApiController { - public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly HouseholdRepository $householdRepository, private readonly HouseholdACLAwareRepositoryInterface $householdACLAwareRepository) {} + public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly HouseholdRepository $householdRepository, private readonly HouseholdACLAwareRepositoryInterface $householdACLAwareRepository) + { + } /** * @Route("/api/1.0/person/household/by-address-reference/{id}.json", diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php index 00503ab3e..9a9ffa86d 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php @@ -44,7 +44,8 @@ class HouseholdCompositionController extends AbstractController private readonly TranslatorInterface $translator, private readonly \Twig\Environment $engine, private readonly UrlGeneratorInterface $urlGenerator - ) {} + ) { + } /** * @Route("/{_locale}/person/household/{household_id}/composition/{composition_id}/delete", name="chill_person_household_composition_delete") diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php index c85edaaf7..0c488dba5 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php @@ -34,7 +34,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class HouseholdController extends AbstractController { - public function __construct(private readonly TranslatorInterface $translator, private readonly PositionRepository $positionRepository, private readonly SerializerInterface $serializer, private readonly Security $security) {} + public function __construct(private readonly TranslatorInterface $translator, private readonly PositionRepository $positionRepository, private readonly SerializerInterface $serializer, private readonly Security $security) + { + } /** * @Route( diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php index 7f895d478..c37cf63c0 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php @@ -30,7 +30,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class HouseholdMemberController extends ApiController { - public function __construct(private readonly UrlGeneratorInterface $generator, private readonly TranslatorInterface $translator, private readonly AccompanyingPeriodRepository $periodRepository) {} + public function __construct(private readonly UrlGeneratorInterface $generator, private readonly TranslatorInterface $translator, private readonly AccompanyingPeriodRepository $periodRepository) + { + } /** * @Route( diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php index 193aad950..c6ffd1fec 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php @@ -29,7 +29,9 @@ class PersonAddressController extends AbstractController /** * PersonAddressController constructor. */ - public function __construct(private readonly ValidatorInterface $validator, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly ValidatorInterface $validator, private readonly TranslatorInterface $translator) + { + } /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/create", name="chill_person_address_create", methods={"POST"}) @@ -37,7 +39,7 @@ class PersonAddressController extends AbstractController public function createAction(mixed $person_id, Request $request) { $person = $this->getDoctrine()->getManager() - ->getRepository(\Chill\PersonBundle\Entity\Person::class) + ->getRepository(Person::class) ->find($person_id); if (null === $person) { @@ -94,7 +96,7 @@ class PersonAddressController extends AbstractController public function editAction(mixed $person_id, mixed $address_id) { $person = $this->getDoctrine()->getManager() - ->getRepository(\Chill\PersonBundle\Entity\Person::class) + ->getRepository(Person::class) ->find($person_id); if (null === $person) { @@ -124,7 +126,7 @@ class PersonAddressController extends AbstractController public function listAction(mixed $person_id) { $person = $this->getDoctrine()->getManager() - ->getRepository(\Chill\PersonBundle\Entity\Person::class) + ->getRepository(Person::class) ->find($person_id); if (null === $person) { @@ -148,7 +150,7 @@ class PersonAddressController extends AbstractController public function newAction(mixed $person_id) { $person = $this->getDoctrine()->getManager() - ->getRepository(\Chill\PersonBundle\Entity\Person::class) + ->getRepository(Person::class) ->find($person_id); if (null === $person) { @@ -177,7 +179,7 @@ class PersonAddressController extends AbstractController public function updateAction(mixed $person_id, mixed $address_id, Request $request) { $person = $this->getDoctrine()->getManager() - ->getRepository(\Chill\PersonBundle\Entity\Person::class) + ->getRepository(Person::class) ->find($person_id); if (null === $person) { diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php index f9c24d2d4..99c3899e6 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php @@ -47,7 +47,8 @@ final class PersonController extends AbstractController private readonly ConfigPersonAltNamesHelper $configPersonAltNameHelper, private readonly ValidatorInterface $validator, private readonly EntityManagerInterface $em, - ) {} + ) { + } /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/general/edit", name="chill_person_general_edit") @@ -106,7 +107,7 @@ final class PersonController extends AbstractController $cFGroup = null; $cFDefaultGroup = $this->em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsDefaultGroup::class) - ->findOneByEntity(\Chill\PersonBundle\Entity\Person::class); + ->findOneByEntity(Person::class); if ($cFDefaultGroup) { $cFGroup = $cFDefaultGroup->getCustomFieldsGroup(); @@ -281,7 +282,7 @@ final class PersonController extends AbstractController /** * easy getting a person by his id. * - * @return \Chill\PersonBundle\Entity\Person + * @return Person */ private function _getPerson(int $id) { diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php index 3b7188513..31965a498 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php @@ -32,7 +32,9 @@ use function count; class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController { - public function __construct(private readonly SimilarPersonMatcher $similarPersonMatcher, private readonly TranslatorInterface $translator, private readonly PersonRepository $personRepository, private readonly PersonMove $personMove, private readonly EventDispatcherInterface $eventDispatcher) {} + public function __construct(private readonly SimilarPersonMatcher $similarPersonMatcher, private readonly TranslatorInterface $translator, private readonly PersonRepository $personRepository, private readonly PersonMove $personMove, private readonly EventDispatcherInterface $eventDispatcher) + { + } /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/confirm", name="chill_person_duplicate_confirm") diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php index a9d60d18e..7a112371d 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php @@ -25,7 +25,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class PersonResourceController extends AbstractController { - public function __construct(private readonly PersonResourceRepository $personResourceRepository, private readonly PersonRepository $personRepository, private readonly EntityManagerInterface $em, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly PersonResourceRepository $personResourceRepository, private readonly PersonRepository $personRepository, private readonly EntityManagerInterface $em, private readonly TranslatorInterface $translator) + { + } /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/{resource_id}/delete", name="chill_person_resource_delete") diff --git a/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php index 03b6975b4..a83b831f1 100644 --- a/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php @@ -39,7 +39,9 @@ use Symfony\Component\Validator\Constraints\NotNull; class ReassignAccompanyingPeriodController extends AbstractController { - public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly UserRepository $userRepository, private readonly AccompanyingPeriodRepository $courseRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly UserRender $userRender, private readonly EntityManagerInterface $em) {} + public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly UserRepository $userRepository, private readonly AccompanyingPeriodRepository $courseRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly UserRender $userRender, private readonly EntityManagerInterface $em) + { + } /** * @Route("/{_locale}/person/accompanying-periods/reassign", name="chill_course_list_reassign") diff --git a/src/Bundle/ChillPersonBundle/Controller/RelationshipApiController.php b/src/Bundle/ChillPersonBundle/Controller/RelationshipApiController.php index 80cc8c79b..eac149245 100644 --- a/src/Bundle/ChillPersonBundle/Controller/RelationshipApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/RelationshipApiController.php @@ -21,7 +21,9 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; class RelationshipApiController extends ApiController { - public function __construct(private readonly ValidatorInterface $validator, private readonly RelationshipRepository $repository) {} + public function __construct(private readonly ValidatorInterface $validator, private readonly RelationshipRepository $repository) + { + } /** * @ParamConverter("person", options={"id": "person_id"}) diff --git a/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php b/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php index 4b8278f9d..6d2b92438 100644 --- a/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php +++ b/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php @@ -27,7 +27,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class ResidentialAddressController extends AbstractController { - public function __construct(private readonly UrlGeneratorInterface $generator, private readonly TranslatorInterface $translator, private readonly ResidentialAddressRepository $residentialAddressRepository) {} + public function __construct(private readonly UrlGeneratorInterface $generator, private readonly TranslatorInterface $translator, private readonly ResidentialAddressRepository $residentialAddressRepository) + { + } /** * @Route("/{_locale}/person/residential-address/{id}/delete", name="chill_person_residential_address_delete") diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php index b97f2ed30..b6b7baf00 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php @@ -22,7 +22,9 @@ use Symfony\Component\Routing\Annotation\Route; class SocialWorkEvaluationApiController extends AbstractController { - public function __construct(private readonly PaginatorFactory $paginatorFactory) {} + public function __construct(private readonly PaginatorFactory $paginatorFactory) + { + } /** * @Route("/api/1.0/person/social-work/evaluation/by-social-action/{action_id}.json", diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php index 2a7f39712..cbbd9a748 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php @@ -21,7 +21,9 @@ use Symfony\Component\HttpFoundation\Response; class SocialWorkGoalApiController extends ApiController { - public function __construct(private readonly GoalRepository $goalRepository, private readonly PaginatorFactory $paginator) {} + public function __construct(private readonly GoalRepository $goalRepository, private readonly PaginatorFactory $paginator) + { + } public function listBySocialAction(Request $request, SocialAction $action): Response { diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php index 9b97d8129..aaedfd330 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php @@ -21,7 +21,9 @@ use Symfony\Component\HttpFoundation\Response; class SocialWorkResultApiController extends ApiController { - public function __construct(private readonly ResultRepository $resultRepository) {} + public function __construct(private readonly ResultRepository $resultRepository) + { + } public function listByGoal(Request $request, Goal $goal): Response { diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php index 6b341e926..5ecc41a4c 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php @@ -26,7 +26,8 @@ final class SocialWorkSocialActionApiController extends ApiController private readonly SocialIssueRepository $socialIssueRepository, private readonly PaginatorFactory $paginator, private readonly ClockInterface $clock, - ) {} + ) { + } public function listBySocialIssueApi($id, Request $request) { diff --git a/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php b/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php index 21792444e..c271f22f4 100644 --- a/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php @@ -22,7 +22,9 @@ use Symfony\Component\HttpFoundation\Request; class TimelinePersonController extends AbstractController { - public function __construct(protected EventDispatcherInterface $eventDispatcher, protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory) {} + public function __construct(protected EventDispatcherInterface $eventDispatcher, protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory) + { + } /** * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/timeline", name="chill_person_timeline") diff --git a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php index 1f484fd91..d5dd41e5b 100644 --- a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php @@ -21,7 +21,9 @@ use Symfony\Component\Routing\Annotation\Route; class UserAccompanyingPeriodController extends AbstractController { - public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly PaginatorFactory $paginatorFactory) {} + public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly PaginatorFactory $paginatorFactory) + { + } /** * @Route("/{_locale}/person/accompanying-periods/my", name="chill_person_accompanying_period_user") diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php index 44992ebef..63000093e 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php @@ -26,7 +26,9 @@ class LoadAccompanyingPeriodWork extends \Doctrine\Bundle\FixturesBundle\Fixture */ private array $cacheEvaluations = []; - public function __construct(private readonly AccompanyingPeriodRepository $periodRepository, private readonly EvaluationRepository $evaluationRepository) {} + public function __construct(private readonly AccompanyingPeriodRepository $periodRepository, private readonly EvaluationRepository $evaluationRepository) + { + } public function getDependencies() { diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php index 30aa345e7..47548ff2c 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php @@ -37,7 +37,8 @@ class LoadCustomFields extends AbstractFixture implements OrderedFixtureInterfac private readonly EntityManagerInterface $entityManager, private readonly CustomFieldChoice $customFieldChoice, private readonly CustomFieldText $customFieldText, - ) {} + ) { + } // put your code here public function getOrder() diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php index 3efcc6386..8fff20a39 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php @@ -24,7 +24,9 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface { use PersonRandomHelper; - public function __construct(private readonly EntityManagerInterface $em) {} + public function __construct(private readonly EntityManagerInterface $em) + { + } public function getDependencies(): array { diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadSocialWorkMetadata.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadSocialWorkMetadata.php index dc1e7b4dd..9c04d73cd 100644 --- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadSocialWorkMetadata.php +++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadSocialWorkMetadata.php @@ -19,7 +19,9 @@ use League\Csv\Reader; class LoadSocialWorkMetadata extends Fixture implements OrderedFixtureInterface { - public function __construct(private readonly SocialWorkMetadata $importer) {} + public function __construct(private readonly SocialWorkMetadata $importer) + { + } public function getOrder() { diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index c5d7a026b..18861e01f 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -401,16 +401,16 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], 'apis' => [ [ - 'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod::class, + 'class' => AccompanyingPeriod::class, 'name' => 'accompanying_course', 'base_path' => '/api/1.0/person/accompanying-course', 'controller' => \Chill\PersonBundle\Controller\AccompanyingCourseApiController::class, 'actions' => [ '_entity' => [ 'roles' => [ - Request::METHOD_GET => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, - Request::METHOD_PATCH => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, - Request::METHOD_PUT => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, + Request::METHOD_GET => AccompanyingPeriodVoter::SEE, + Request::METHOD_PATCH => AccompanyingPeriodVoter::SEE, + Request::METHOD_PUT => AccompanyingPeriodVoter::SEE, ], 'methods' => [ Request::METHOD_GET => true, @@ -426,8 +426,8 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac Request::METHOD_HEAD => false, ], 'roles' => [ - Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, - Request::METHOD_DELETE => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, + Request::METHOD_POST => AccompanyingPeriodVoter::SEE, + Request::METHOD_DELETE => AccompanyingPeriodVoter::SEE, ], ], 'resource' => [ @@ -438,8 +438,8 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac Request::METHOD_HEAD => false, ], 'roles' => [ - Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, - Request::METHOD_DELETE => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, + Request::METHOD_POST => AccompanyingPeriodVoter::SEE, + Request::METHOD_DELETE => AccompanyingPeriodVoter::SEE, ], ], 'comment' => [ @@ -450,8 +450,8 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac Request::METHOD_HEAD => false, ], 'roles' => [ - Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, - Request::METHOD_DELETE => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, + Request::METHOD_POST => AccompanyingPeriodVoter::SEE, + Request::METHOD_DELETE => AccompanyingPeriodVoter::SEE, ], ], 'requestor' => [ @@ -462,8 +462,8 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac Request::METHOD_HEAD => false, ], 'roles' => [ - Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, - Request::METHOD_DELETE => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, + Request::METHOD_POST => AccompanyingPeriodVoter::SEE, + Request::METHOD_DELETE => AccompanyingPeriodVoter::SEE, ], ], 'scope' => [ @@ -474,8 +474,8 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac Request::METHOD_HEAD => false, ], 'roles' => [ - Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, - Request::METHOD_DELETE => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, + Request::METHOD_POST => AccompanyingPeriodVoter::SEE, + Request::METHOD_DELETE => AccompanyingPeriodVoter::SEE, ], ], 'socialissue' => [ @@ -487,8 +487,8 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], 'controller_action' => 'socialIssueApi', 'roles' => [ - Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, - Request::METHOD_DELETE => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, + Request::METHOD_POST => AccompanyingPeriodVoter::SEE, + Request::METHOD_DELETE => AccompanyingPeriodVoter::SEE, ], ], 'work' => [ @@ -500,7 +500,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], 'controller_action' => 'workApi', 'roles' => [ - Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, + Request::METHOD_POST => AccompanyingPeriodVoter::SEE, Request::METHOD_DELETE => 'ALWAYS_FAILS', ], ], @@ -511,7 +511,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac Request::METHOD_HEAD => false, ], 'roles' => [ - Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, + Request::METHOD_POST => AccompanyingPeriodVoter::SEE, ], ], // 'confidential' => [ @@ -618,7 +618,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac 'class' => \Chill\PersonBundle\Entity\Person::class, 'name' => 'person', 'base_path' => '/api/1.0/person/person', - 'base_role' => \Chill\PersonBundle\Security\Authorization\PersonVoter::SEE, + 'base_role' => PersonVoter::SEE, 'controller' => \Chill\PersonBundle\Controller\PersonApiController::class, 'actions' => [ '_entity' => [ @@ -629,10 +629,10 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac Request::METHOD_PATCH => true, ], 'roles' => [ - Request::METHOD_GET => \Chill\PersonBundle\Security\Authorization\PersonVoter::SEE, - Request::METHOD_HEAD => \Chill\PersonBundle\Security\Authorization\PersonVoter::SEE, - Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\PersonVoter::CREATE, - Request::METHOD_PATCH => \Chill\PersonBundle\Security\Authorization\PersonVoter::CREATE, + Request::METHOD_GET => PersonVoter::SEE, + Request::METHOD_HEAD => PersonVoter::SEE, + Request::METHOD_POST => PersonVoter::CREATE, + Request::METHOD_PATCH => PersonVoter::CREATE, ], ], 'address' => [ @@ -1001,7 +1001,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac 'property' => 'step', ], 'supports' => [ - \Chill\PersonBundle\Entity\AccompanyingPeriod::class, + AccompanyingPeriod::class, ], 'initial_marking' => 'DRAFT', 'places' => [ diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodInfo.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodInfo.php index d68292927..fe552dfe0 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodInfo.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodInfo.php @@ -84,5 +84,6 @@ class AccompanyingPeriodInfo * @ORM\Column(type="text") */ public readonly string $discriminator, - ) {} + ) { + } } diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index 8dfb9155a..a35dc3abf 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -392,9 +392,13 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues */ public function getReferrers(): ReadableCollection { - return $this->referrersHistory + $users = $this->referrersHistory ->filter(fn (AccompanyingPeriodWorkReferrerHistory $h) => null === $h->getEndDate()) - ->map(fn (AccompanyingPeriodWorkReferrerHistory $h) => $h->getUser()); + ->map(fn (AccompanyingPeriodWorkReferrerHistory $h) => $h->getUser()) + ->getValues() + ; + + return new ArrayCollection(array_values($users)); } public function getReferrersHistory(): Collection diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkReferrerHistory.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkReferrerHistory.php index 0086faab2..8ce1c7749 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkReferrerHistory.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkReferrerHistory.php @@ -59,7 +59,8 @@ class AccompanyingPeriodWorkReferrerHistory implements TrackCreationInterface, T * @ORM\Column(type="date_immutable", nullable=false) */ private \DateTimeImmutable $startDate - ) {} + ) { + } public function getId(): ?int { diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php index 81a84c64a..c972f453a 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php @@ -41,7 +41,7 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface private ?AccompanyingPeriod $accompanyingPeriod = null; /** - * @ORM\Column(type="text") + * @ORM\Column(type="text", nullable=false, options={"default":""}) * * @Groups({"read", "write", "docgen:read"}) * diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php index ab9ca7c7d..41b798a3f 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/UserHistory.php @@ -58,7 +58,8 @@ class UserHistory implements TrackCreationInterface * @ORM\Column(type="datetime_immutable", nullable=false, options={"default": "now()"}) */ private \DateTimeImmutable $startDate = new \DateTimeImmutable('now') - ) {} + ) { + } public function getAccompanyingPeriod(): AccompanyingPeriod { diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index 57c1a0314..db06be0f4 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -532,7 +532,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI */ public function __construct() { - $this->calendars = new \Doctrine\Common\Collections\ArrayCollection(); + $this->calendars = new ArrayCollection(); $this->accompanyingPeriodParticipations = new ArrayCollection(); $this->spokenLanguages = new ArrayCollection(); $this->addresses = new ArrayCollection(); diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterHistory.php b/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterHistory.php index 04cad642b..89ee1f5af 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterHistory.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person/PersonCenterHistory.php @@ -59,7 +59,8 @@ class PersonCenterHistory implements TrackCreationInterface, TrackUpdateInterfac * @ORM\Column(type="date_immutable", nullable=false) */ private ?\DateTimeImmutable $startDate = null - ) {} + ) { + } public function getCenter(): ?Center { diff --git a/src/Bundle/ChillPersonBundle/Event/Person/PersonAddressMoveEvent.php b/src/Bundle/ChillPersonBundle/Event/Person/PersonAddressMoveEvent.php index cf15018fd..a65f68102 100644 --- a/src/Bundle/ChillPersonBundle/Event/Person/PersonAddressMoveEvent.php +++ b/src/Bundle/ChillPersonBundle/Event/Person/PersonAddressMoveEvent.php @@ -29,7 +29,9 @@ class PersonAddressMoveEvent extends Event private ?HouseholdMember $previousMembership = null; - public function __construct(private readonly Person $person) {} + public function __construct(private readonly Person $person) + { + } /** * Get the date of the move. diff --git a/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php b/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php index c6b366fc8..60d521424 100644 --- a/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php +++ b/src/Bundle/ChillPersonBundle/EventListener/AccompanyingPeriodWorkEventListener.php @@ -17,7 +17,9 @@ use Symfony\Component\Security\Core\Security; class AccompanyingPeriodWorkEventListener { - public function __construct(private readonly Security $security) {} + public function __construct(private readonly Security $security) + { + } public function prePersistAccompanyingPeriodWork(AccompanyingPeriodWork $work): void { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php index 522b2ecdd..6d15566af 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; class AdministrativeLocationAggregator implements AggregatorInterface { - public function __construct(private readonly LocationRepository $locationRepository, private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly LocationRepository $locationRepository, private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php index 259d5fb66..9ea9998b3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; class ClosingMotiveAggregator implements AggregatorInterface { - public function __construct(private readonly ClosingMotiveRepositoryInterface $motiveRepository, private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly ClosingMotiveRepositoryInterface $motiveRepository, private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php index 0e3e5f735..3c404c513 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php @@ -19,7 +19,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ConfidentialAggregator implements AggregatorInterface { - public function __construct(private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php index 32afe5247..53906931a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php @@ -28,7 +28,8 @@ class CreatorJobAggregator implements AggregatorInterface public function __construct( private readonly UserJobRepository $jobRepository, private readonly TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { @@ -79,7 +80,9 @@ class CreatorJobAggregator implements AggregatorInterface return Declarations::ACP_TYPE; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php index f5dc99115..f0dbec2c4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php @@ -26,7 +26,9 @@ final readonly class DurationAggregator implements AggregatorInterface 'day', ]; - public function __construct(private TranslatorInterface $translator) {} + public function __construct(private TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php index 0217166d2..c215eeb6a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php @@ -19,7 +19,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class EmergencyAggregator implements AggregatorInterface { - public function __construct(private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php index a90896ccd..de2f9305e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class EvaluationAggregator implements AggregatorInterface { - public function __construct(private EvaluationRepository $evaluationRepository, private TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private EvaluationRepository $evaluationRepository, private TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php index 3fa612988..2d6dbeae4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php @@ -28,7 +28,9 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class GeographicalUnitStatAggregator implements AggregatorInterface { - public function __construct(private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php index de42039c1..d7dff6265 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php @@ -19,7 +19,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class IntensityAggregator implements AggregatorInterface { - public function __construct(private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobWorkingOnCourseAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobWorkingOnCourseAggregator.php index 69f443300..bb2df08d3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobWorkingOnCourseAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobWorkingOnCourseAggregator.php @@ -28,7 +28,8 @@ final readonly class JobWorkingOnCourseAggregator implements AggregatorInterface public function __construct( private UserJobRepositoryInterface $userJobRepository, private TranslatableStringHelperInterface $translatableStringHelper, - ) {} + ) { + } public function addRole(): ?string { @@ -72,7 +73,9 @@ final readonly class JobWorkingOnCourseAggregator implements AggregatorInterface return Declarations::ACP_TYPE; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php index 823b10d86..78349dd56 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php @@ -27,7 +27,9 @@ final readonly class ReferrerAggregator implements AggregatorInterface private const P = 'acp_ref_agg_date'; - public function __construct(private UserRepository $userRepository, private UserRender $userRender, private RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private UserRepository $userRepository, private UserRender $userRender, private RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php index 9f58b6539..b0a44bcd1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php @@ -27,7 +27,8 @@ readonly class ReferrerScopeAggregator implements AggregatorInterface public function __construct( private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper, - ) {} + ) { + } public function addRole(): ?string { @@ -78,7 +79,9 @@ readonly class ReferrerScopeAggregator implements AggregatorInterface return Declarations::ACP_TYPE; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php index ec168ceaf..824d7431f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php @@ -19,7 +19,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; final readonly class RequestorAggregator implements AggregatorInterface { - public function __construct(private TranslatorInterface $translator) {} + public function __construct(private TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php index 06dbc906d..d7cdfbab1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class ScopeAggregator implements AggregatorInterface { - public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeWorkingOnCourseAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeWorkingOnCourseAggregator.php index 8b3466158..7248b5b98 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeWorkingOnCourseAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeWorkingOnCourseAggregator.php @@ -28,7 +28,8 @@ final readonly class ScopeWorkingOnCourseAggregator implements AggregatorInterfa public function __construct( private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper, - ) {} + ) { + } public function addRole(): ?string { @@ -72,7 +73,9 @@ final readonly class ScopeWorkingOnCourseAggregator implements AggregatorInterfa return Declarations::ACP_TYPE; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php index 7abad2602..4459d634a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class SocialActionAggregator implements AggregatorInterface { - public function __construct(private SocialActionRender $actionRender, private SocialActionRepository $actionRepository) {} + public function __construct(private SocialActionRender $actionRender, private SocialActionRepository $actionRepository) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php index 8c0cbfbd5..02746f82a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class SocialIssueAggregator implements AggregatorInterface { - public function __construct(private SocialIssueRepository $issueRepository, private SocialIssueRender $issueRender) {} + public function __construct(private SocialIssueRepository $issueRepository, private SocialIssueRender $issueRender) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php index a9439a63f..5623a7212 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php @@ -27,7 +27,9 @@ final readonly class StepAggregator implements AggregatorInterface private const P = 'acp_step_agg_date'; - public function __construct(private RollingDateConverterInterface $rollingDateConverter, private TranslatorInterface $translator) {} + public function __construct(private RollingDateConverterInterface $rollingDateConverter, private TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php index 0702edf6f..0bf536929 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php @@ -27,7 +27,8 @@ final readonly class UserJobAggregator implements AggregatorInterface public function __construct( private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { @@ -78,7 +79,9 @@ final readonly class UserJobAggregator implements AggregatorInterface return Declarations::ACP_TYPE; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserWorkingOnCourseAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserWorkingOnCourseAggregator.php index b27477fd8..f9b033784 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserWorkingOnCourseAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserWorkingOnCourseAggregator.php @@ -27,7 +27,8 @@ final readonly class UserWorkingOnCourseAggregator implements AggregatorInterfac public function __construct( private UserRender $userRender, private UserRepositoryInterface $userRepository, - ) {} + ) { + } public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php index 9ff2ad50a..593e23420 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; class EvaluationTypeAggregator implements AggregatorInterface { - public function __construct(private readonly EvaluationRepository $evaluationRepository, private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly EvaluationRepository $evaluationRepository, private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/HavingEndDateAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/HavingEndDateAggregator.php index 4dfddab81..8960cbd86 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/HavingEndDateAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/HavingEndDateAggregator.php @@ -19,7 +19,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class HavingEndDateAggregator implements AggregatorInterface { - public function __construct(private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php index b73b2e600..4b13bd477 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php @@ -19,11 +19,12 @@ use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\Query\Expr; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Contracts\Translation\TranslatorInterface; class ChildrenNumberAggregator implements AggregatorInterface { - public function __construct(private readonly TranslatorInterface $translator, private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { @@ -71,7 +72,7 @@ class ChildrenNumberAggregator implements AggregatorInterface public function getLabels($key, array $values, $data) { - return static function ($value): string { + return static function (null|int|string $value): string { if ('_header' === $value) { return 'Number of children'; } @@ -80,7 +81,7 @@ class ChildrenNumberAggregator implements AggregatorInterface return ''; } - return $value; + return (string) $value; }; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php index 3dc3a1398..45263dd52 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php @@ -24,7 +24,9 @@ use Symfony\Component\Form\FormBuilderInterface; class CompositionAggregator implements AggregatorInterface { - public function __construct(private readonly HouseholdCompositionTypeRepository $typeRepository, private readonly TranslatableStringHelper $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly HouseholdCompositionTypeRepository $typeRepository, private readonly TranslatableStringHelper $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php index 2ca286b57..68ed28492 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php @@ -24,7 +24,8 @@ final readonly class AgeAggregator implements AggregatorInterface, ExportElement { public function __construct( private RollingDateConverterInterface $rollingDateConverter, - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ByHouseholdCompositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ByHouseholdCompositionAggregator.php index af1018f6e..06647dbc7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ByHouseholdCompositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ByHouseholdCompositionAggregator.php @@ -27,7 +27,9 @@ class ByHouseholdCompositionAggregator implements AggregatorInterface { private const PREFIX = 'acp_by_household_compo_agg'; - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CenterAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CenterAggregator.php index 4881241f4..79d28c24e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CenterAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CenterAggregator.php @@ -27,7 +27,8 @@ final readonly class CenterAggregator implements AggregatorInterface public function __construct( private CenterRepositoryInterface $centerRepository, private RollingDateConverterInterface $rollingDateConverter, - ) {} + ) { + } public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php index b8d204dc5..e54714d7a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php @@ -25,7 +25,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; final readonly class CountryOfBirthAggregator implements AggregatorInterface, ExportElementValidatedInterface { - public function __construct(private CountryRepository $countriesRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator) {} + public function __construct(private CountryRepository $countriesRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php index 0181c6e7b..05a9273e5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php @@ -20,7 +20,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; final readonly class GenderAggregator implements AggregatorInterface { - public function __construct(private TranslatorInterface $translator) {} + public function __construct(private TranslatorInterface $translator) + { + } public function addRole(): ?string { @@ -39,7 +41,9 @@ final readonly class GenderAggregator implements AggregatorInterface return Declarations::PERSON_TYPE; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php index 8ce51a3ab..8691f8cd3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php @@ -26,7 +26,9 @@ use Symfony\Component\Form\FormBuilderInterface; class GeographicalUnitAggregator implements AggregatorInterface { - public function __construct(private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php index eb1e52d9b..f44b949dc 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php @@ -28,7 +28,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; final readonly class HouseholdPositionAggregator implements AggregatorInterface, ExportElementValidatedInterface { - public function __construct(private TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper, private PositionRepository $positionRepository, private RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper, private PositionRepository $positionRepository, private RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php index 1555a5a12..c0f86ea25 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class MaritalStatusAggregator implements AggregatorInterface { - public function __construct(private MaritalStatusRepository $maritalStatusRepository, private TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private MaritalStatusRepository $maritalStatusRepository, private TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php index 9daca5b34..bc11565e4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php @@ -24,7 +24,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; final readonly class NationalityAggregator implements AggregatorInterface, ExportElementValidatedInterface { - public function __construct(private CountryRepository $countriesRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator) {} + public function __construct(private CountryRepository $countriesRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/PostalCodeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/PostalCodeAggregator.php new file mode 100644 index 000000000..abb8b0e27 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/PostalCodeAggregator.php @@ -0,0 +1,100 @@ +add('calc_date', PickRollingDateType::class, [ + 'label' => 'export.aggregator.person.by_postal_code.at_date', + ]); + } + + public function getFormDefaultData(): array + { + return ['calc_date' => new RollingDate(RollingDate::T_TODAY)]; + } + + public function getLabels($key, array $values, mixed $data) + { + return function (null|int|string $value): string { + if ('_header' === $value) { + return 'export.aggregator.person.by_postal_code.header'; + } + + if (null === $value) { + return ''; + } + + return $value; + }; + } + + public function getQueryKeys($data) + { + return [self::PREFIX.'_postal_code_code', self::PREFIX.'_postal_code_label']; + } + + public function getTitle() + { + return 'export.aggregator.person.by_postal_code.title'; + } + + public function addRole(): ?string + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $p = self::PREFIX; + + $qb + ->leftJoin( + 'person.householdAddresses', + "{$p}_household_addresses", + Join::WITH, + "{$p}_household_addresses.validFrom <= :{$p}_calc_date AND ({$p}_household_addresses.validTo IS NULL OR {$p}_household_addresses.validTo > :{$p}_calc_date)" + ) + ->setParameter("{$p}_calc_date", $this->rollingDateConverter->convert($data['calc_date'])) + ->leftJoin("{$p}_household_addresses.address", "{$p}_address") + ->leftJoin("{$p}_address.postcode", "{$p}_postal_code") + ->addSelect("{$p}_postal_code.code AS {$p}_postal_code_code") + ->addSelect("{$p}_postal_code.name AS {$p}_postal_code_label") + ->addGroupBy("{$p}_postal_code_code") + ->addGroupBy("{$p}_postal_code_label") + ; + } + + public function applyOn() + { + return Declarations::PERSON_TYPE; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php index 9abf5c1e7..901bd1cb6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php @@ -22,7 +22,9 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class ActionTypeAggregator implements AggregatorInterface { - public function __construct(private SocialActionRepository $socialActionRepository, private SocialActionRender $actionRender, private SocialIssueRender $socialIssueRender, private SocialIssueRepository $socialIssueRepository) {} + public function __construct(private SocialActionRepository $socialActionRepository, private SocialActionRender $actionRender, private SocialIssueRender $socialIssueRender, private SocialIssueRepository $socialIssueRepository) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorAggregator.php new file mode 100644 index 000000000..d879e42f5 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorAggregator.php @@ -0,0 +1,85 @@ +addSelect("IDENTITY(acpw.createdBy) AS {$p}_select") + ->addGroupBy("{$p}_select"); + } + + public function applyOn(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + } + + public function getFormDefaultData(): array + { + return []; + } + + public function getLabels($key, array $values, mixed $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'export.aggregator.course_work.by_creator.Creator'; + } + + if (null === $value || '' === $value) { + return ''; + } + + $r = $this->userRepository->find($value); + + return $this->userRender->renderString($r, ['absence' => false, 'user_job' => false, 'main_scope' => false]); + }; + } + + public function getQueryKeys($data): array + { + return [self::PREFIX.'_select']; + } + + public function getTitle(): string + { + return 'export.aggregator.course_work.by_creator.title'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorJobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorJobAggregator.php new file mode 100644 index 000000000..ea4499e1d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorJobAggregator.php @@ -0,0 +1,102 @@ +leftJoin( + UserJobHistory::class, + "{$p}_history", + Join::WITH, + $qb->expr()->andX( + $qb->expr()->eq("{$p}_history.user", 'acpw.createdBy'), + $qb->expr()->andX( + $qb->expr()->lte("{$p}_history.startDate", 'acpw.createdAt'), + $qb->expr()->orX( + $qb->expr()->isNull("{$p}_history.endDate"), + $qb->expr()->gt("{$p}_history.endDate", 'acpw.createdAt') + ) + ) + ) + ) + ->addSelect("IDENTITY({$p}_history.job) AS {$p}_select") + ->addGroupBy("{$p}_select"); + } + + public function applyOn(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + } + + public function getFormDefaultData(): array + { + return []; + } + + public function getLabels($key, array $values, mixed $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'export.aggregator.course_work.by_creator_job.Creator\'s job'; + } + + if (null === $value || '' === $value || null === $j = $this->jobRepository->find($value)) { + return ''; + } + + return $this->translatableStringHelper->localize( + $j->getLabel() + ); + }; + } + + public function getQueryKeys($data): array + { + return [self::PREFIX.'_select']; + } + + public function getTitle(): string + { + return 'export.aggregator.course_work.by_creator_job.title'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorScopeAggregator.php new file mode 100644 index 000000000..6654212b0 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorScopeAggregator.php @@ -0,0 +1,102 @@ +leftJoin( + UserScopeHistory::class, + "{$p}_history", + Join::WITH, + $qb->expr()->andX( + $qb->expr()->eq("{$p}_history.user", 'acpw.createdBy'), + $qb->expr()->andX( + $qb->expr()->lte("{$p}_history.startDate", 'acpw.createdAt'), + $qb->expr()->orX( + $qb->expr()->isNull("{$p}_history.endDate"), + $qb->expr()->gt("{$p}_history.endDate", 'acpw.createdAt') + ) + ) + ) + ) + ->addSelect("IDENTITY({$p}_history.scope) AS {$p}_select") + ->addGroupBy("{$p}_select"); + } + + public function applyOn(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + } + + public function getFormDefaultData(): array + { + return []; + } + + public function getLabels($key, array $values, mixed $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'export.aggregator.course_work.by_creator_scope.Creator\'s scope'; + } + + if (null === $value || '' === $value || null === $s = $this->scopeRepository->find($value)) { + return ''; + } + + return $this->translatableStringHelper->localize( + $s->getName() + ); + }; + } + + public function getQueryKeys($data): array + { + return [self::PREFIX.'_select']; + } + + public function getTitle(): string + { + return 'export.aggregator.course_work.by_creator_scope.title'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php index a9f8e020a..95e1b8518 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php @@ -19,7 +19,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class CurrentActionAggregator implements AggregatorInterface { - public function __construct(private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php index ce1e381f2..84367578e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class GoalAggregator implements AggregatorInterface { - public function __construct(private GoalRepository $goalRepository, private TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private GoalRepository $goalRepository, private TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalResultAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalResultAggregator.php index e1549f315..de4e1d46e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalResultAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalResultAggregator.php @@ -21,7 +21,9 @@ use Symfony\Component\Form\FormBuilderInterface; class GoalResultAggregator implements AggregatorInterface { - public function __construct(private readonly ResultRepository $resultRepository, private readonly GoalRepository $goalRepository, private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly ResultRepository $resultRepository, private readonly GoalRepository $goalRepository, private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/HandlingThirdPartyAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/HandlingThirdPartyAggregator.php index f58246a25..f02e05f4f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/HandlingThirdPartyAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/HandlingThirdPartyAggregator.php @@ -25,7 +25,9 @@ final readonly class HandlingThirdPartyAggregator implements AggregatorInterface { private const PREFIX = 'acpw_handling3party_agg'; - public function __construct(private LabelThirdPartyHelper $labelThirdPartyHelper) {} + public function __construct(private LabelThirdPartyHelper $labelThirdPartyHelper) + { + } public function buildForm(FormBuilderInterface $builder) { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php index c8336b09b..1cd226e27 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php @@ -28,7 +28,8 @@ final readonly class JobAggregator implements AggregatorInterface public function __construct( private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { @@ -58,7 +59,9 @@ final readonly class JobAggregator implements AggregatorInterface return Declarations::SOCIAL_WORK_ACTION_TYPE; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php index c97229048..9488cb091 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php @@ -29,7 +29,8 @@ final readonly class ReferrerAggregator implements AggregatorInterface private UserRepository $userRepository, private UserRender $userRender, private RollingDateConverterInterface $rollingDateConverter - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php index 63a037f21..53628d329 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class ResultAggregator implements AggregatorInterface { - public function __construct(private ResultRepository $resultRepository, private TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private ResultRepository $resultRepository, private TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php index dfffaa9e4..060712f6a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php @@ -28,7 +28,8 @@ final readonly class ScopeAggregator implements AggregatorInterface public function __construct( private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { @@ -58,7 +59,9 @@ final readonly class ScopeAggregator implements AggregatorInterface return Declarations::SOCIAL_WORK_ACTION_TYPE; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/AvgDurationAPWorkPersonAssociatedOnAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/AvgDurationAPWorkPersonAssociatedOnAccompanyingPeriod.php new file mode 100644 index 000000000..209bf8889 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Export/AvgDurationAPWorkPersonAssociatedOnAccompanyingPeriod.php @@ -0,0 +1,133 @@ +filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; + } + + public function buildForm(FormBuilderInterface $builder) + { + } + + public function getFormDefaultData(): array + { + return []; + } + + public function getAllowedFormattersTypes(): array + { + return [FormatterInterface::TYPE_TABULAR]; + } + + public function getDescription(): string + { + return 'export.export.avg_duration_acpw_associate_on_period.description'; + } + + public function getGroup(): string + { + return 'Exports of social work actions'; + } + + public function getLabels($key, array $values, $data) + { + if ('export_result' !== $key) { + throw new \LogicException("the key {$key} is not used by this export"); + } + + return static fn ($value) => '_header' === $value ? 'export.export.avg_duration_acpw_associate_on_period.header' : $value; + } + + public function getQueryKeys($data): array + { + return ['export_result']; + } + + public function getResult($query, $data) + { + return $query->getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getTitle(): string + { + return 'export.export.avg_duration_acpw_associate_on_period.title'; + } + + public function getType(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + $centers = array_map(static fn ($el) => $el['center'], $acl); + + $qb = $this->accompanyingPeriodWorkRepository->createQueryBuilder('acpw'); + + $qb + ->join('acpw.accompanyingPeriod', 'acp') + ->join('acp.participations', 'acppart') + ->join('acppart.person', 'person'); + + if ($this->filterStatsByCenters) { + $qb + ->andWhere( + $qb->expr()->exists( + 'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person + AND acl_count_person_history.center IN (:authorized_centers) + ' + ) + ) + ->setParameter('authorized_centers', $centers); + } + + $qb->select('AVG(DATE_DIFF(COALESCE(acpw.endDate, CURRENT_DATE()), acpw.startDate)) AS export_result'); + + AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + + return $qb; + } + + public function requiredRole(): string + { + return AccompanyingPeriodVoter::STATS; + } + + public function supportsModifiers(): array + { + return [ + Declarations::SOCIAL_WORK_ACTION_TYPE, + Declarations::ACP_TYPE, + Declarations::PERSON_TYPE, + ]; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Export/AvgDurationAPWorkPersonAssociatedOnWork.php b/src/Bundle/ChillPersonBundle/Export/Export/AvgDurationAPWorkPersonAssociatedOnWork.php new file mode 100644 index 000000000..db3b84ce7 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Export/AvgDurationAPWorkPersonAssociatedOnWork.php @@ -0,0 +1,132 @@ +filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; + } + + public function buildForm(FormBuilderInterface $builder) + { + } + + public function getFormDefaultData(): array + { + return []; + } + + public function getAllowedFormattersTypes(): array + { + return [FormatterInterface::TYPE_TABULAR]; + } + + public function getDescription(): string + { + return 'export.export.avg_duration_acpw_associate_on_work.description'; + } + + public function getGroup(): string + { + return 'Exports of social work actions'; + } + + public function getLabels($key, array $values, $data) + { + if ('export_result' !== $key) { + throw new \LogicException("the key {$key} is not used by this export"); + } + + return static fn ($value) => '_header' === $value ? 'export.export.avg_duration_acpw_associate_on_work.header' : $value; + } + + public function getQueryKeys($data): array + { + return ['export_result']; + } + + public function getResult($query, $data) + { + return $query->getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getTitle(): string + { + return 'export.export.avg_duration_acpw_associate_on_work.title'; + } + + public function getType(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + $centers = array_map(static fn ($el) => $el['center'], $acl); + + $qb = $this->accompanyingPeriodWorkRepository->createQueryBuilder('acpw'); + + $qb + ->join('acpw.accompanyingPeriod', 'acp') + ->join('acpw.persons', 'person'); + + if ($this->filterStatsByCenters) { + $qb + ->andWhere( + $qb->expr()->exists( + 'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person + AND acl_count_person_history.center IN (:authorized_centers) + ' + ) + ) + ->setParameter('authorized_centers', $centers); + } + + $qb->select('AVG(DATE_DIFF(COALESCE(acpw.endDate, CURRENT_DATE()), acpw.startDate)) AS export_result'); + + AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + + return $qb; + } + + public function requiredRole(): string + { + return AccompanyingPeriodVoter::STATS; + } + + public function supportsModifiers(): array + { + return [ + Declarations::SOCIAL_WORK_ACTION_TYPE, + Declarations::ACP_TYPE, + Declarations::PERSON_TYPE, + ]; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php similarity index 90% rename from src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWork.php rename to src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php index e274ac5cd..a73e4f037 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php @@ -25,7 +25,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Form\FormBuilderInterface; -class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInterface +class CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod implements ExportInterface, GroupedExportInterface { private readonly bool $filterStatsByCenters; @@ -53,7 +53,7 @@ class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInter public function getDescription(): string { - return 'Count social work actions by various parameters'; + return 'export.export.count_accompanying_period_work_associate_person.description'; } public function getGroup(): string @@ -68,7 +68,7 @@ class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInter } $labels = array_combine($values, $values); - $labels['_header'] = $this->getTitle(); + $labels['_header'] = 'export.export.count_accompanying_period_work_associate_person.header'; return static fn ($value) => $labels[$value]; } @@ -85,7 +85,7 @@ class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInter public function getTitle(): string { - return 'Count social work actions'; + return 'export.export.count_accompanying_period_work_associate_person.title'; } public function getType(): string diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWork.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWork.php new file mode 100644 index 000000000..4f43a78b0 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingPeriodWorkAssociatePersonOnWork.php @@ -0,0 +1,139 @@ +filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; + } + + public function buildForm(FormBuilderInterface $builder): void + { + // No form necessary? + } + + public function getFormDefaultData(): array + { + return []; + } + + public function getAllowedFormattersTypes(): array + { + return [FormatterInterface::TYPE_TABULAR]; + } + + public function getDescription(): string + { + return 'export.export.count_accompanying_period_work_associate_work.description'; + } + + public function getGroup(): string + { + return 'Exports of social work actions'; + } + + public function getLabels($key, array $values, $data) + { + if ('export_result' !== $key) { + throw new \LogicException("the key {$key} is not used by this export"); + } + + $labels = array_combine($values, $values); + $labels['_header'] = 'export.export.count_accompanying_period_work_associate_work.header'; + + return static fn ($value) => $labels[$value]; + } + + public function getQueryKeys($data): array + { + return ['export_result']; + } + + public function getResult($query, $data) + { + return $query->getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getTitle(): string + { + return 'export.export.count_accompanying_period_work_associate_work.title'; + } + + public function getType(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder + { + $centers = array_map(static fn ($el) => $el['center'], $acl); + + $qb = $this->em->createQueryBuilder(); + + $qb + ->from(AccompanyingPeriod\AccompanyingPeriodWork::class, 'acpw') + ->join('acpw.accompanyingPeriod', 'acp') + ->join('acpw.persons', 'person'); + + if ($this->filterStatsByCenters) { + $qb + ->andWhere( + $qb->expr()->exists( + 'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person + AND acl_count_person_history.center IN (:authorized_centers) + ' + ) + ) + ->setParameter('authorized_centers', $centers); + } + + $qb->select('COUNT(DISTINCT acpw.id) as export_result'); + + AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + + return $qb; + } + + public function requiredRole(): string + { + return AccompanyingPeriodVoter::STATS; + } + + public function supportsModifiers(): array + { + return [ + Declarations::SOCIAL_WORK_ACTION_TYPE, + Declarations::ACP_TYPE, + Declarations::PERSON_TYPE, + ]; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php index 0cbe7b3e8..c5c66cd01 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php @@ -35,7 +35,9 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } - public function buildForm(FormBuilderInterface $builder) {} + public function buildForm(FormBuilderInterface $builder) + { + } public function getFormDefaultData(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php b/src/Bundle/ChillPersonBundle/Export/Export/CountHouseholdInPeriod.php similarity index 91% rename from src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php rename to src/Bundle/ChillPersonBundle/Export/Export/CountHouseholdInPeriod.php index 82a5c4aa4..a65dcb217 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountHouseholdInPeriod.php @@ -17,6 +17,7 @@ use Chill\MainBundle\Export\GroupedExportInterface; use Chill\MainBundle\Form\Type\PickRollingDateType; use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; +use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Household\Household; use Chill\PersonBundle\Entity\Person\PersonCenterHistory; use Chill\PersonBundle\Export\Declarations; @@ -26,7 +27,7 @@ use Doctrine\ORM\Query; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Form\FormBuilderInterface; -class CountHousehold implements ExportInterface, GroupedExportInterface +class CountHouseholdInPeriod implements ExportInterface, GroupedExportInterface { private const TR_PREFIX = 'export.export.nb_household_with_course.'; private readonly bool $filterStatsByCenters; @@ -120,7 +121,10 @@ class CountHousehold implements ExportInterface, GroupedExportInterface ->join('person.accompanyingPeriodParticipations', 'acppart') ->join('acppart.accompanyingPeriod', 'acp') ->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL') - ->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date'])); + ->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)') + ->andWhere('acp.step != :count_acp_step') + ->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date'])) + ->setParameter('count_acp_step', AccompanyingPeriod::STEP_DRAFT); $qb ->select('COUNT(DISTINCT household.id) AS household_export_result') @@ -135,7 +139,6 @@ class CountHousehold implements ExportInterface, GroupedExportInterface ' ) ) - ->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)') ->setParameter('authorized_centers', $centers); } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountPersonOnAccompanyingPeriodWorkAssociatePersonOnWork.php b/src/Bundle/ChillPersonBundle/Export/Export/CountPersonOnAccompanyingPeriodWorkAssociatePersonOnWork.php new file mode 100644 index 000000000..13dd0d512 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountPersonOnAccompanyingPeriodWorkAssociatePersonOnWork.php @@ -0,0 +1,139 @@ +filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; + } + + public function buildForm(FormBuilderInterface $builder): void + { + // No form necessary? + } + + public function getFormDefaultData(): array + { + return []; + } + + public function getAllowedFormattersTypes(): array + { + return [FormatterInterface::TYPE_TABULAR]; + } + + public function getDescription(): string + { + return 'export.export.count_person_on_acpw_associate_person_on_work.description'; + } + + public function getGroup(): string + { + return 'Exports of social work actions'; + } + + public function getLabels($key, array $values, $data) + { + if ('export_result' !== $key) { + throw new \LogicException("the key {$key} is not used by this export"); + } + + $labels = array_combine($values, $values); + $labels['_header'] = 'export.export.count_person_on_acpw_associate_person_on_work.header'; + + return static fn ($value) => $labels[$value]; + } + + public function getQueryKeys($data): array + { + return ['export_result']; + } + + public function getResult($query, $data) + { + return $query->getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getTitle(): string + { + return 'export.export.count_person_on_acpw_associate_person_on_work.title'; + } + + public function getType(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder + { + $centers = array_map(static fn ($el) => $el['center'], $acl); + + $qb = $this->em->createQueryBuilder(); + + $qb + ->from(AccompanyingPeriod\AccompanyingPeriodWork::class, 'acpw') + ->join('acpw.accompanyingPeriod', 'acp') + ->join('acpw.persons', 'person'); + + if ($this->filterStatsByCenters) { + $qb + ->andWhere( + $qb->expr()->exists( + 'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person + AND acl_count_person_history.center IN (:authorized_centers) + ' + ) + ) + ->setParameter('authorized_centers', $centers); + } + + $qb->select('COUNT(DISTINCT person.id) as export_result'); + + AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + + return $qb; + } + + public function requiredRole(): string + { + return AccompanyingPeriodVoter::STATS; + } + + public function supportsModifiers(): array + { + return [ + Declarations::SOCIAL_WORK_ACTION_TYPE, + Declarations::ACP_TYPE, + Declarations::PERSON_TYPE, + ]; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php index 881a38db6..6c9efcfc3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php @@ -19,27 +19,22 @@ use Chill\MainBundle\Form\Type\PickRollingDateType; use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; -use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation; -use Chill\PersonBundle\Entity\Person\PersonCenterHistory; use Chill\PersonBundle\Export\Declarations; +use Chill\PersonBundle\Export\Helper\FilterListAccompanyingPeriodHelperInterface; use Chill\PersonBundle\Export\Helper\ListAccompanyingPeriodHelper; use Chill\PersonBundle\Security\Authorization\PersonVoter; use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\EntityManagerInterface; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Form\FormBuilderInterface; final readonly class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface { - private bool $filterStatsByCenters; - public function __construct( private EntityManagerInterface $entityManager, private RollingDateConverterInterface $rollingDateConverter, private ListAccompanyingPeriodHelper $listAccompanyingPeriodHelper, - ParameterBagInterface $parameterBag, + private FilterListAccompanyingPeriodHelperInterface $filterListAccompanyingPeriodHelper, ) { - $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } public function buildForm(FormBuilderInterface $builder) @@ -101,8 +96,6 @@ final readonly class ListAccompanyingPeriod implements ListInterface, GroupedExp public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - $centers = array_map(static fn ($el) => $el['center'], $acl); - $qb = $this->entityManager->createQueryBuilder(); $qb @@ -110,18 +103,7 @@ final readonly class ListAccompanyingPeriod implements ListInterface, GroupedExp ->andWhere('acp.step != :list_acp_step') ->setParameter('list_acp_step', AccompanyingPeriod::STEP_DRAFT); - if ($this->filterStatsByCenters) { - $qb - ->andWhere( - $qb->expr()->exists( - 'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part - JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person) - WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers) - ' - ) - ) - ->setParameter('authorized_centers', $centers); - } + $this->filterListAccompanyingPeriodHelper->addFilterAccompanyingPeriods($qb, $requiredModifiers, $acl, $data); $this->listAccompanyingPeriodHelper->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date'])); diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php similarity index 91% rename from src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php rename to src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php index 81c60bae6..6ebfa1bec 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php @@ -28,11 +28,11 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkGoal; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkReferrerHistory; use Chill\PersonBundle\Entity\AccompanyingPeriod\UserHistory; use Chill\PersonBundle\Entity\Person; -use Chill\PersonBundle\Entity\Person\PersonCenterHistory; use Chill\PersonBundle\Entity\SocialWork\Evaluation; use Chill\PersonBundle\Entity\SocialWork\Goal; use Chill\PersonBundle\Entity\SocialWork\Result; use Chill\PersonBundle\Export\Declarations; +use Chill\PersonBundle\Export\Helper\FilterListAccompanyingPeriodHelperInterface; use Chill\PersonBundle\Export\Helper\LabelPersonHelper; use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository; use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository; @@ -44,10 +44,9 @@ use Chill\ThirdPartyBundle\Export\Helper\LabelThirdPartyHelper; use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\QueryBuilder; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Form\FormBuilderInterface; -class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterface +final readonly class ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod implements ListInterface, GroupedExportInterface { private const FIELDS = [ 'id', @@ -79,8 +78,6 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac 'updatedBy', ]; - private readonly bool $filterStatsByCenters; - public function __construct( private readonly EntityManagerInterface $entityManager, private readonly DateTimeHelper $dateTimeHelper, @@ -94,9 +91,8 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac private readonly RollingDateConverterInterface $rollingDateConverter, private readonly AggregateStringHelper $aggregateStringHelper, private readonly SocialActionRepository $socialActionRepository, - ParameterBagInterface $parameterBag, + private readonly FilterListAccompanyingPeriodHelperInterface $filterListAccompanyingPeriodHelper, ) { - $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } public function buildForm(FormBuilderInterface $builder) @@ -121,7 +117,7 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac public function getDescription(): string { - return 'export.list.acpw.List description'; + return 'export.list.acpw_associate_period.List description'; } public function getGroup(): string @@ -190,12 +186,12 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac public function getResult($query, $data) { - return dump($query->getQuery()->getResult(AbstractQuery::HYDRATE_SCALAR)); + return $query->getQuery()->getResult(AbstractQuery::HYDRATE_SCALAR); } public function getTitle(): string { - return 'export.list.acpw.List of accompanying period works'; + return 'export.list.acpw_associate_period.List of accompanying period works'; } public function getType(): string @@ -206,6 +202,7 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { $centers = array_map(static fn ($el) => $el['center'], $acl); + $calcDate = $data['calc_date'] ?? new RollingDate(RollingDate::T_TODAY); $qb = $this->entityManager->createQueryBuilder(); @@ -220,23 +217,13 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac ->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL') // get participants at the given date ->andWhere('acppart.startDate <= :calc_date AND (acppart.endDate > :calc_date OR acppart.endDate IS NULL)') - ->setParameter('calc_date', $this->rollingDateConverter->convert($data['calc_date'])); + ->setParameter('calc_date', $this->rollingDateConverter->convert($calcDate)); - if ($this->filterStatsByCenters) { - $qb - ->andWhere( - $qb->expr()->exists( - 'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person - AND acl_count_person_history.center IN (:authorized_centers) - ' - ) - ) - ->setParameter('authorized_centers', $centers); - } + $this->filterListAccompanyingPeriodHelper->addFilterAccompanyingPeriods($qb, $requiredModifiers, $acl, $data); AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); - $this->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date'])); + $this->addSelectClauses($qb, $this->rollingDateConverter->convert($calcDate)); return $qb; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWork.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWork.php new file mode 100644 index 000000000..f55f254b8 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWork.php @@ -0,0 +1,335 @@ +add('calc_date', PickRollingDateType::class, [ + 'label' => 'export.list.acpw.Date of calculation for associated elements', + 'help' => 'export.list.acpw.help_description', + 'required' => true, + ]); + } + + public function getFormDefaultData(): array + { + return ['calc_date' => new RollingDate(RollingDate::T_TODAY)]; + } + + public function getAllowedFormattersTypes() + { + return [FormatterInterface::TYPE_LIST]; + } + + public function getDescription(): string + { + return 'export.list.acpw_associate_work.List description'; + } + + public function getGroup(): string + { + return 'Exports of social work actions'; + } + + public function getLabels($key, array $values, $data) + { + return match ($key) { + 'startDate', 'endDate', 'createdAt', 'updatedAt' => $this->dateTimeHelper->getLabel('export.list.acpw.'.$key), + 'socialAction' => function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acpw.'.$key; + } + + if (null === $value) { + return ''; + } + + return $this->socialActionRender->renderString( + $this->socialActionRepository->find($value), + [] + ); + }, + 'socialIssue' => function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acpw.'.$key; + } + + if (null === $value) { + return ''; + } + + return $this->socialIssueRender->renderString( + $this->socialIssueRepository->find($value), + [] + ); + }, + 'createdBy', 'updatedBy', 'acp_user' => $this->userHelper->getLabel($key, $values, 'export.list.acpw.'.$key), + 'referrers' => $this->userHelper->getLabel($key, $values, 'export.list.acpw.'.$key), + // 'acpwReferrers' => $this->userHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key), + 'personsName' => $this->personHelper->getLabelMulti($key, $values, 'export.list.acpw.'.$key), + 'handlingThierParty' => $this->thirdPartyHelper->getLabel($key, $values, 'export.list.acpw.'.$key), + 'thirdParties' => $this->thirdPartyHelper->getLabelMulti($key, $values, 'export.list.acpw.'.$key), + 'personsId', 'goalsId', 'goalResultsId', 'resultsId', 'evaluationsId' => $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.acpw.'.$key), + 'goalsTitle', 'goalResultsTitle', 'resultsTitle', 'evaluationsTitle' => $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, 'export.list.acpw.'.$key), + default => static function ($value) use ($key) { + if ('_header' === $value) { + return 'export.list.acpw.'.$key; + } + + if (null === $value) { + return ''; + } + + return $value; + }, + }; + } + + public function getQueryKeys($data) + { + return self::FIELDS; + } + + public function getResult($query, $data) + { + return $query->getQuery()->getResult(AbstractQuery::HYDRATE_SCALAR); + } + + public function getTitle(): string + { + return 'export.list.acpw_associate_work.List of accompanying period works'; + } + + public function getType(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + $centers = array_map(static fn ($el) => $el['center'], $acl); + $calcDate = $data['calc_date'] ?? new RollingDate(RollingDate::T_TODAY); + + $qb = $this->entityManager->createQueryBuilder(); + + $qb + ->from(AccompanyingPeriodWork::class, 'acpw') + ->distinct() + ->select('acpw.id AS id') + ->join('acpw.accompanyingPeriod', 'acp') + ->join('acpw.persons', 'person') + ; + + $this->filterListAccompanyingPeriodHelper->addFilterAccompanyingPeriods($qb, $requiredModifiers, $acl, $data); + + AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); + + $this->addSelectClauses($qb, $this->rollingDateConverter->convert($calcDate)); + + return $qb; + } + + public function requiredRole(): string + { + return AccompanyingPeriodVoter::STATS; + } + + public function supportsModifiers(): array + { + return [ + Declarations::SOCIAL_WORK_ACTION_TYPE, + Declarations::ACP_TYPE, + Declarations::PERSON_TYPE, + ]; + } + + private function addSelectClauses(QueryBuilder $qb, \DateTimeImmutable $calcDate): void + { + // add regular fields + foreach ([ + 'startDate', + 'endDate', + 'note', + 'createdAt', + 'updatedAt', + ] as $field) { + $qb->addSelect(sprintf('acpw.%s AS %s', $field, $field)); + } + + // those with identity + foreach ([ + 'createdBy', + 'updatedBy', + 'handlingThierParty', + ] as $field) { + $qb->addSelect(sprintf('IDENTITY(acpw.%s) AS %s', $field, $field)); + } + + // join socialaction + $qb + ->join('acpw.socialAction', 'sa') + ->addSelect('sa.id AS socialActionId') + ->addSelect('sa.id AS socialAction') + ->addSelect('IDENTITY(sa.issue) AS socialIssue'); + + // join acp + $qb + ->addSelect('acp.id AS acp_id') + ->addSelect('IDENTITY(acp.user) AS acp_user'); + + // persons + $qb + ->addSelect('(SELECT AGGREGATE(person_acpw_member.id) FROM '.Person::class.' person_acpw_member ' + .'WHERE person_acpw_member MEMBER OF acpw.persons) AS personsId') + ->addSelect('(SELECT AGGREGATE(person1_acpw_member.id) FROM '.Person::class.' person1_acpw_member ' + .'WHERE person1_acpw_member MEMBER OF acpw.persons) AS personsName'); + + // referrers => at date XXXX + $qb + ->addSelect('(SELECT JSON_BUILD_OBJECT(\'uid\', IDENTITY(history.user), \'d\', history.startDate) FROM '.UserHistory::class.' history '. + 'WHERE history.accompanyingPeriod = acp AND history.startDate <= :calcDate AND (history.endDate IS NULL OR history.endDate > :calcDate)) AS referrers'); + + /* + // acpwReferrers at date XXX + $qb + ->addSelect('( + SELECT IDENTITY(acpw_ref_history.accompanyingPeriodWork) AS acpw_ref_history_id, + JSON_BUILD_OBJECT(\'uid\', IDENTITY(acpw_ref_history.user), \'d\', acpw_ref_history.startDate) + FROM ' . AccompanyingPeriodWorkReferrerHistory::class . ' acpw_ref_history ' . + 'WHERE acpw_ref_history.accompanyingPeriodWork = acpw AND acpw_ref_history.startDate <= :calcDate AND (acpw_ref_history.endDate IS NULL or acpw_ref_history.endDate > :calcDate) GROUP BY acpw_ref_history_id) AS acpwReferrers' + ); + */ + + // thirdparties + $qb + ->addSelect('(SELECT AGGREGATE(tp.id) FROM '.ThirdParty::class.' tp ' + .'WHERE tp MEMBER OF acpw.thirdParties) AS thirdParties'); + + // goals + $qb + ->addSelect('(SELECT AGGREGATE(IDENTITY(goal.goal)) FROM '.AccompanyingPeriodWorkGoal::class.' goal ' + .'WHERE goal MEMBER OF acpw.goals) AS goalsId') + ->addSelect('(SELECT AGGREGATE(g.title) FROM '.AccompanyingPeriodWorkGoal::class.' goal1 ' + .'LEFT JOIN '.Goal::class.' g WITH goal1.goal = g.id WHERE goal1 MEMBER OF acpw.goals) AS goalsTitle'); + + // goals results + $qb + ->addSelect('(SELECT AGGREGATE(wr.id) FROM '.Result::class.' wr ' + .'JOIN '.AccompanyingPeriodWorkGoal::class.' wg WITH wr MEMBER OF wg.results ' + .'WHERE wg MEMBER OF acpw.goals) AS goalResultsId') + ->addSelect('(SELECT AGGREGATE(wr1.title) FROM '.Result::class.' wr1 ' + .'JOIN '.AccompanyingPeriodWorkGoal::class.' wg1 WITH wr1 MEMBER OF wg1.results ' + .'WHERE wg1 MEMBER OF acpw.goals) AS goalResultsTitle'); + + // results + $qb + ->addSelect('(SELECT AGGREGATE(result.id) FROM '.Result::class.' result ' + .'WHERE result MEMBER OF acpw.results ) AS resultsId ') + ->addSelect('(SELECT AGGREGATE (result1.title) FROM '.Result::class.' result1 ' + .'WHERE result1 MEMBER OF acpw.results ) AS resultsTitle '); + + // evaluations + $qb + ->addSelect('(SELECT AGGREGATE(IDENTITY(we.evaluation)) FROM '.AccompanyingPeriodWorkEvaluation::class.' we ' + .'WHERE we MEMBER OF acpw.accompanyingPeriodWorkEvaluations ) AS evaluationsId ') + ->addSelect('(SELECT AGGREGATE(ev.title) FROM '.AccompanyingPeriodWorkEvaluation::class.' we1 ' + .'LEFT JOIN '.Evaluation::class.' ev WITH we1.evaluation = ev.id ' + .'WHERE we1 MEMBER OF acpw.accompanyingPeriodWorkEvaluations ) AS evaluationsTitle '); + + $qb->setParameter('calcDate', $calcDate); + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php index 6b3eba107..fe707d56a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php @@ -26,8 +26,8 @@ use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation; use Chill\PersonBundle\Entity\AccompanyingPeriod\UserHistory; use Chill\PersonBundle\Entity\Person; -use Chill\PersonBundle\Entity\Person\PersonCenterHistory; use Chill\PersonBundle\Export\Declarations; +use Chill\PersonBundle\Export\Helper\FilterListAccompanyingPeriodHelperInterface; use Chill\PersonBundle\Export\Helper\LabelPersonHelper; use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository; use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository; @@ -37,10 +37,9 @@ use Chill\PersonBundle\Templating\Entity\SocialIssueRender; use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\QueryBuilder; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Form\FormBuilderInterface; -class ListEvaluation implements ListInterface, GroupedExportInterface +final readonly class ListEvaluation implements ListInterface, GroupedExportInterface { private const FIELDS = [ 'id', @@ -69,8 +68,6 @@ class ListEvaluation implements ListInterface, GroupedExportInterface 'updatedBy', ]; - private readonly bool $filterStatsByCenters; - public function __construct( private readonly EntityManagerInterface $entityManager, private readonly SocialIssueRender $socialIssueRender, @@ -83,9 +80,8 @@ class ListEvaluation implements ListInterface, GroupedExportInterface private readonly TranslatableStringExportLabelHelper $translatableStringExportLabelHelper, private readonly AggregateStringHelper $aggregateStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter, - ParameterBagInterface $parameterBag, + private FilterListAccompanyingPeriodHelperInterface $filterListAccompanyingPeriodHelper, ) { - $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } public function buildForm(FormBuilderInterface $builder) @@ -193,6 +189,7 @@ class ListEvaluation implements ListInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { $centers = array_map(static fn ($el) => $el['center'], $acl); + $calcDate = $data['calc_date'] ?? new RollingDate(RollingDate::T_TODAY); $qb = $this->entityManager->createQueryBuilder(); @@ -208,23 +205,13 @@ class ListEvaluation implements ListInterface, GroupedExportInterface ->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL') // get participants at the given date ->andWhere('acppart.startDate <= :calc_date AND (acppart.endDate > :calc_date OR acppart.endDate IS NULL)') - ->setParameter('calc_date', $this->rollingDateConverter->convert($data['calc_date'])); + ->setParameter('calc_date', $this->rollingDateConverter->convert($calcDate)); - if ($this->filterStatsByCenters) { - $qb - ->andWhere( - $qb->expr()->exists( - 'SELECT 1 FROM '.PersonCenterHistory::class.' acl_count_person_history WHERE acl_count_person_history.person = person - AND acl_count_person_history.center IN (:authorized_centers) - ' - ) - ) - ->setParameter('authorized_centers', $centers); - } + $this->filterListAccompanyingPeriodHelper->addFilterAccompanyingPeriods($qb, $requiredModifiers, $acl, $data); AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); - $this->addSelectClauses($qb, $this->rollingDateConverter->convert($data['calc_date'])); + $this->addSelectClauses($qb, $this->rollingDateConverter->convert($calcDate)); return $qb; } @@ -278,7 +265,7 @@ class ListEvaluation implements ListInterface, GroupedExportInterface // referrers => at date XXXX $qb ->addSelect('(SELECT JSON_BUILD_OBJECT(\'uid\', IDENTITY(history.user), \'d\', history.startDate) FROM '.UserHistory::class.' history '. - 'WHERE history.accompanyingPeriod = acp AND history.startDate <= :calc_date AND (history.endDate IS NULL OR history.endDate > :calc_date)) AS referrers'); + 'WHERE history.accompanyingPeriod = acp AND history.startDate <= :calc_date AND (history.endDate IS NULL OR history.endDate > :calc_date)) AS acpw_referrers'); // persons $qb diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php index 46770fab8..21f7a5923 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php @@ -20,6 +20,7 @@ use Chill\MainBundle\Export\ListInterface; use Chill\MainBundle\Form\Type\PickRollingDateType; use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; +use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Household\Household; use Chill\PersonBundle\Entity\Household\HouseholdComposition; use Chill\PersonBundle\Entity\Household\HouseholdMember; @@ -144,7 +145,9 @@ class ListHouseholdInPeriod implements ListInterface, GroupedExportInterface ->join('acppart.accompanyingPeriod', 'acp') ->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL') ->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)') - ->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date'])); + ->andWhere('acp.step != :list_acp_step') + ->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date'])) + ->setParameter('list_acp_step', AccompanyingPeriod::STEP_DRAFT); if ($this->filterStatsByCenters) { $qb diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php index b0e916765..8529fac10 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php @@ -332,13 +332,18 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou if (null === $value) { return ''; } - $decoded = json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR); if ('_header' === $value) { $label = $cfType->getChoices($cf)[$slugChoice]; return $this->translatableStringHelper->localize($cf->getName()) - .' | '.$label; + .' | '.$label; + } + + try { + $decoded = json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \RuntimeException(sprintf('unable to decode json: %s, %s', json_last_error(), json_last_error_msg()), $e->getCode(), $e); } if ('_other' === $slugChoice && $cfType->isChecked($cf, $slugChoice, $decoded)) { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php index 1a1fd0316..a11df19c7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php @@ -135,7 +135,9 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat return PersonVoter::DUPLICATE; } - public function validateForm($data, ExecutionContextInterface $context) {} + public function validateForm($data, ExecutionContextInterface $context) + { + } protected function getHeaders(): array { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php index d1cf49a5d..d29ba3fde 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriodDetails.php @@ -20,15 +20,14 @@ use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Person; -use Chill\PersonBundle\Entity\Person\PersonCenterHistory; use Chill\PersonBundle\Export\Declarations; +use Chill\PersonBundle\Export\Helper\FilterListAccompanyingPeriodHelperInterface; use Chill\PersonBundle\Export\Helper\ListAccompanyingPeriodHelper; use Chill\PersonBundle\Export\Helper\ListPersonHelper; use Chill\PersonBundle\Security\Authorization\PersonVoter; use DateTimeImmutable; use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\EntityManagerInterface; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Form\FormBuilderInterface; /** @@ -36,16 +35,13 @@ use Symfony\Component\Form\FormBuilderInterface; */ final readonly class ListPersonWithAccompanyingPeriodDetails implements ListInterface, GroupedExportInterface { - private bool $filterStatsByCenters; - public function __construct( private ListPersonHelper $listPersonHelper, private ListAccompanyingPeriodHelper $listAccompanyingPeriodHelper, private EntityManagerInterface $entityManager, private RollingDateConverterInterface $rollingDateConverter, - ParameterBagInterface $parameterBag, + private FilterListAccompanyingPeriodHelperInterface $filterListAccompanyingPeriodHelper, ) { - $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } public function buildForm(FormBuilderInterface $builder) @@ -122,14 +118,7 @@ final readonly class ListPersonWithAccompanyingPeriodDetails implements ListInte ->join('acppart.accompanyingPeriod', 'acp') ->andWhere($qb->expr()->neq('acp.step', "'".AccompanyingPeriod::STEP_DRAFT."'")); - if ($this->filterStatsByCenters) { - $qb - ->andWhere( - $qb->expr()->exists( - 'SELECT 1 FROM '.PersonCenterHistory::class.' pch WHERE pch.person = person.id AND pch.center IN (:authorized_centers)' - ) - )->setParameter('authorized_centers', $centers); - } + $this->filterListAccompanyingPeriodHelper->addFilterAccompanyingPeriods($qb, $requiredModifiers, $acl, $data); $this->listPersonHelper->addSelect($qb, ListPersonHelper::FIELDS, $this->rollingDateConverter->convert($data['address_date'])); $this->listAccompanyingPeriodHelper->addSelectClauses($qb, $this->rollingDateConverter->convert($data['address_date'])); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php index 6bcb4f8b8..d34eb7a15 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php @@ -22,7 +22,9 @@ use Symfony\Component\Form\FormBuilderInterface; class ActiveOnDateFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php index 3b7c4fe25..fb5d6dc02 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php @@ -21,7 +21,9 @@ use Symfony\Component\Form\FormBuilderInterface; class ActiveOneDayBetweenDatesFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php index 915a2c9e6..c79f94daf 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php @@ -20,7 +20,9 @@ use Symfony\Component\Form\FormBuilderInterface; class AdministrativeLocationFilter implements FilterInterface { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php index 7fb032050..442dc505b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php @@ -22,7 +22,9 @@ use Symfony\Component\Form\FormBuilderInterface; class ClosingMotiveFilter implements FilterInterface { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php index 4c8baf147..230267904 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php @@ -28,7 +28,9 @@ class ConfidentialFilter implements FilterInterface private const DEFAULT_CHOICE = 'false'; - public function __construct(private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorFilter.php index a73f82f69..4fa2c2d1d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorFilter.php @@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\User; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickUserDynamicType; use Chill\PersonBundle\Export\Declarations; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -59,7 +60,13 @@ class CreatorFilter implements FilterInterface { return [ 'Filtered by creator: only %creators%', [ - '%creators%' => implode(', ', array_map(static fn (User $u) => $u->getLabel(), $data['accepted_creators'])), + '%creators%' => implode( + ', ', + array_map( + static fn (User $u) => $u->getLabel(), + $data['accepted_creators'] instanceof Collection ? $data['accepted_creators']->toArray() : $data['accepted_creators'] + ) + ), ], ]; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php index cc7e21b08..790afc66b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php @@ -29,7 +29,8 @@ class CreatorJobFilter implements FilterInterface public function __construct( private readonly TranslatableStringHelper $translatableStringHelper, private readonly UserJobRepositoryInterface $userJobRepository - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php index 671b87407..10528a007 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php @@ -28,7 +28,9 @@ class EmergencyFilter implements FilterInterface private const DEFAULT_CHOICE = 'false'; - public function __construct(private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php index bec01c249..95dcb5c62 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php @@ -22,7 +22,9 @@ use Symfony\Component\Form\FormBuilderInterface; class EvaluationFilter implements FilterInterface { - public function __construct(private readonly EvaluationRepositoryInterface $evaluationRepository, private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly EvaluationRepositoryInterface $evaluationRepository, private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php index 695831f9c..ce193e1a4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php @@ -23,6 +23,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress; use Chill\PersonBundle\Export\Declarations; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; @@ -32,7 +33,9 @@ use Symfony\Component\Form\FormBuilderInterface; */ class GeographicalUnitStatFilter implements FilterInterface { - public function __construct(private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { @@ -68,7 +71,10 @@ class GeographicalUnitStatFilter implements FilterInterface 'acp_geog_filter_date', $this->rollingDateConverter->convert($data['date_calc']) ) - ->setParameter('acp_geog_filter_units', array_map(static fn (SimpleGeographicalUnitDTO $unitDTO) => $unitDTO->id, $data['units'])); + ->setParameter('acp_geog_filter_units', array_map( + static fn (SimpleGeographicalUnitDTO $unitDTO) => $unitDTO->id, + $data['units'] instanceof Collection ? $data['units']->toArray() : $data['units'] + )); } public function applyOn(): string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HandlingThirdPartyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HandlingThirdPartyFilter.php index 80bc7b04a..818f7567a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HandlingThirdPartyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HandlingThirdPartyFilter.php @@ -16,6 +16,7 @@ use Chill\PersonBundle\Export\Declarations; use Chill\ThirdPartyBundle\Entity\ThirdParty; use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType; use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -25,7 +26,8 @@ final readonly class HandlingThirdPartyFilter implements FilterInterface public function __construct( private ThirdPartyRender $thirdPartyRender, - ) {} + ) { + } public function getTitle() { @@ -52,7 +54,10 @@ final readonly class HandlingThirdPartyFilter implements FilterInterface [ '%3parties%' => implode( ', ', - array_map(fn (ThirdParty $thirdParty) => $this->thirdPartyRender->renderString($thirdParty, []), $data['handling_3parties']) + array_map( + fn (ThirdParty $thirdParty) => $this->thirdPartyRender->renderString($thirdParty, []), + $data['handling_3parties'] instanceof Collection ? $data['handling_3parties']->toArray() : $data['handling_3parties'] + ) ), ], ]; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php index 72bcce39e..7df3ff0d2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php @@ -22,7 +22,9 @@ use Symfony\Component\Form\FormBuilderInterface; class HasNoReferrerFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php index 88d1d6933..ca5ccaf27 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php @@ -22,7 +22,9 @@ use Symfony\Component\Form\FormBuilderInterface; class HasTemporaryLocationFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HavingAnAccompanyingPeriodInfoWithinDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HavingAnAccompanyingPeriodInfoWithinDatesFilter.php index d6436f8b4..b6a05a466 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HavingAnAccompanyingPeriodInfoWithinDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HavingAnAccompanyingPeriodInfoWithinDatesFilter.php @@ -29,7 +29,8 @@ final readonly class HavingAnAccompanyingPeriodInfoWithinDatesFilter implements { public function __construct( private RollingDateConverterInterface $rollingDateConverter, - ) {} + ) { + } public function buildForm(FormBuilderInterface $builder): void { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php index 3eb8bbb24..d1d3de19d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php @@ -28,7 +28,9 @@ class IntensityFilter implements FilterInterface private const DEFAULT_CHOICE = 'occasional'; - public function __construct(private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/JobWorkingOnCourseFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/JobWorkingOnCourseFilter.php index 5f0cf373b..8ba1b585d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/JobWorkingOnCourseFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/JobWorkingOnCourseFilter.php @@ -21,6 +21,7 @@ use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodInfo; use Chill\PersonBundle\Export\Declarations; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; @@ -38,7 +39,8 @@ readonly class JobWorkingOnCourseFilter implements FilterInterface private UserJobRepositoryInterface $userJobRepository, private RollingDateConverterInterface $rollingDateConverter, private TranslatableStringHelperInterface $translatableStringHelper, - ) {} + ) { + } public function addRole(): ?string { @@ -115,7 +117,7 @@ readonly class JobWorkingOnCourseFilter implements FilterInterface ', ', array_map( fn (UserJob $userJob) => $this->translatableStringHelper->localize($userJob->getLabel()), - $data['jobs'] + $data['jobs'] instanceof Collection ? $data['jobs']->toArray() : $data['jobs'] ) ), '%start_date%' => $this->rollingDateConverter->convert($data['start_date'])?->format('d-m-Y'), diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php index 1b85f6cd7..2427b1637 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php @@ -22,7 +22,9 @@ use Symfony\Component\Form\FormBuilderInterface; class OpenBetweenDatesFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php index 617577cde..7ded268f6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php @@ -22,7 +22,9 @@ use Symfony\Component\Form\FormBuilderInterface; class OriginFilter implements FilterInterface { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php index 30f67f664..22a4b560f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php @@ -28,7 +28,9 @@ class ReferrerFilter implements FilterInterface private const PU = 'acp_referrer_filter_users'; - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php index 0b7ce6994..90f6953f1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php @@ -31,7 +31,9 @@ final readonly class RequestorFilter implements FilterInterface 'no requestor' => 'no_requestor', ]; - public function __construct(private TranslatorInterface $translator, private EntityManagerInterface $em) {} + public function __construct(private TranslatorInterface $translator, private EntityManagerInterface $em) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ScopeWorkingOnCourseFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ScopeWorkingOnCourseFilter.php index 36ec27357..9aec79c94 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ScopeWorkingOnCourseFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ScopeWorkingOnCourseFilter.php @@ -21,6 +21,7 @@ use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodInfo; use Chill\PersonBundle\Export\Declarations; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; @@ -38,7 +39,8 @@ readonly class ScopeWorkingOnCourseFilter implements FilterInterface private ScopeRepositoryInterface $scopeRepository, private RollingDateConverterInterface $rollingDateConverter, private TranslatableStringHelperInterface $translatableStringHelper, - ) {} + ) { + } public function addRole(): ?string { @@ -110,7 +112,7 @@ readonly class ScopeWorkingOnCourseFilter implements FilterInterface ', ', array_map( fn (Scope $scope) => $this->translatableStringHelper->localize($scope->getName()), - $data['scopes'] + $data['scopes'] instanceof Collection ? $data['scopes']->toArray() : $data['scopes'] ) ), '%start_date%' => $this->rollingDateConverter->convert($data['start_date'])?->format('d-m-Y'), diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php index cba86c257..702c7533c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php @@ -12,6 +12,8 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Export\FilterInterface; +use Chill\MainBundle\Form\Type\PickRollingDateType; +use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Chill\PersonBundle\Export\Declarations; @@ -19,10 +21,18 @@ use Chill\PersonBundle\Form\Type\PickSocialActionType; use Chill\PersonBundle\Templating\Entity\SocialActionRender; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Contracts\Translation\TranslatorInterface; final readonly class SocialActionFilter implements FilterInterface { - public function __construct(private SocialActionRender $actionRender) {} + private const PREFIX = 'acp_by_social_action_filter'; + + public function __construct( + private SocialActionRender $actionRender, + private RollingDateConverterInterface $rollingDateConverter, + private TranslatorInterface $translator + ) { + } public function addRole(): ?string { @@ -31,17 +41,40 @@ final readonly class SocialActionFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->andWhere( - $qb->expr()->exists( - sprintf( - 'SELECT 1 FROM %s acp_by_social_action_filter WHERE acp_by_social_action_filter.socialAction ' - .'IN (:acp_by_social_action_filter_actions) AND acp_by_social_action_filter.accompanyingPeriod = acp', - AccompanyingPeriod\AccompanyingPeriodWork::class - ) - ) - ); + $p = self::PREFIX; - $qb->setParameter('acp_by_social_action_filter_actions', SocialAction::getDescendantsWithThisForActions($data['accepted_socialactions'])); + $dql = + sprintf( + 'SELECT 1 FROM %s acp_by_social_action_filter WHERE acp_by_social_action_filter.accompanyingPeriod = acp ', + AccompanyingPeriod\AccompanyingPeriodWork::class + ); + + if (0 < count($data['accepted_socialactions'])) { + $dql .= 'AND acp_by_social_action_filter.socialAction IN (:acp_by_social_action_filter_actions)'; + $qb->setParameter("{$p}_actions", SocialAction::getDescendantsWithThisForActions($data['accepted_socialactions'])); + } + + if (null !== ($data['start_date_after'] ?? null)) { + $dql .= " AND acp_by_social_action_filter.startDate > :{$p}_start_date_after"; + $qb->setParameter("{$p}_start_date_after", $this->rollingDateConverter->convert($data['start_date_after'])); + } + + if (null !== ($data['start_date_before'] ?? null)) { + $dql .= " AND acp_by_social_action_filter.startDate <= :{$p}_start_date_before"; + $qb->setParameter("{$p}_start_date_before", $this->rollingDateConverter->convert($data['start_date_before'])); + } + + if (null !== ($data['end_date_after'] ?? null)) { + $dql .= " AND acp_by_social_action_filter.endDate > :{$p}_end_date_after OR acp_by_social_action_filter.endDate IS NULL"; + $qb->setParameter("{$p}_end_date_after", $this->rollingDateConverter->convert($data['end_date_after'])); + } + + if (null !== ($data['end_date_before'] ?? null)) { + $dql .= " AND acp_by_social_action_filter.endDate <= :{$p}_end_date_before OR acp_by_social_action_filter.endDate IS NULL"; + $qb->setParameter("{$p}_end_date_before", $this->rollingDateConverter->convert($data['end_date_before'])); + } + + $qb->andWhere($qb->expr()->exists($dql)); } public function applyOn(): string @@ -51,14 +84,44 @@ final readonly class SocialActionFilter implements FilterInterface public function buildForm(FormBuilderInterface $builder) { - $builder->add('accepted_socialactions', PickSocialActionType::class, [ - 'multiple' => true, - ]); + $builder + ->add('accepted_socialactions', PickSocialActionType::class, [ + 'multiple' => true, + 'label' => 'export.filter.course.by_social_action.Accepted socialactions', + 'help' => 'export.filter.course.by_social_action.accepted socialations help', + ]) + ->add('start_date_after', PickRollingDateType::class, [ + 'label' => 'export.filter.course.by_social_action.start date after', + 'help' => 'export.filter.course.by_social_action.start date after help', + 'required' => false, + ]) + ->add('start_date_before', PickRollingDateType::class, [ + 'label' => 'export.filter.course.by_social_action.start date before', + 'help' => 'export.filter.course.by_social_action.start date before help', + 'required' => false, + ]) + ->add('end_date_after', PickRollingDateType::class, [ + 'label' => 'export.filter.course.by_social_action.end date after', + 'help' => 'export.filter.course.by_social_action.end date after help', + 'required' => false, + ]) + ->add('end_date_before', PickRollingDateType::class, [ + 'label' => 'export.filter.course.by_social_action.end date before', + 'help' => 'export.filter.course.by_social_action.end date before help', + 'required' => false, + ]) + ; } public function getFormDefaultData(): array { - return []; + return [ + 'accepted_social_actions' => [], + 'start_date_after' => null, + 'start_date_before' => null, + 'end_date_after' => null, + 'end_date_before' => null, + ]; } public function describeAction($data, $format = 'string'): array @@ -73,13 +136,17 @@ final readonly class SocialActionFilter implements FilterInterface ]); } - return ['Filtered by socialactions: only %socialactions%', [ + return ['export.filter.course.by_social_action.Filtered by socialactions: only %socialactions%', [ '%socialactions%' => implode(', ', $actions), + '%start_date_after%' => null === ($data['start_date_after'] ?? null) ? '('.$this->translator->trans('export.filter.course.by_social_action.date ignored').')' : $this->rollingDateConverter->convert($data['start_date_after'])->format('d-m-Y'), + '%start_date_before%' => null === ($data['start_date_before'] ?? null) ? '('.$this->translator->trans('export.filter.course.by_social_action.date ignored').')' : $this->rollingDateConverter->convert($data['start_date_before'])->format('d-m-Y'), + '%end_date_after%' => null === ($data['end_date_after'] ?? null) ? '('.$this->translator->trans('export.filter.course.by_social_action.date ignored').')' : $this->rollingDateConverter->convert($data['end_date_after'])->format('d-m-Y'), + '%end_date_before%' => null === ($data['end_date_before'] ?? null) ? '('.$this->translator->trans('export.filter.course.by_social_action.date ignored').')' : $this->rollingDateConverter->convert($data['end_date_before'])->format('d-m-Y'), ]]; } public function getTitle(): string { - return 'Filter by socialaction'; + return 'export.filter.course.by_social_action.title'; } } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterBetweenDates.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterBetweenDates.php index 9d49f820b..8b0a4c085 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterBetweenDates.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterBetweenDates.php @@ -17,6 +17,7 @@ use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Export\Declarations; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; @@ -38,7 +39,9 @@ class StepFilterBetweenDates implements FilterInterface 'course.inactive_long' => AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_LONG, ]; - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatorInterface $translator) + { + } public function addRole(): ?string { @@ -98,7 +101,10 @@ class StepFilterBetweenDates implements FilterInterface public function describeAction($data, $format = 'string') { - $steps = array_map(fn (string $step) => $this->translator->trans(array_flip(self::STEPS)[$step]), $data['accepted_steps_multi']); + $steps = array_map( + fn (string $step) => $this->translator->trans(array_flip(self::STEPS)[$step]), + $data['accepted_steps_multi'] instanceof Collection ? $data['accepted_steps_multi']->toArray() : $data['accepted_steps_multi'] + ); return ['export.filter.course.by_step.Filtered by steps: only %step% and between %date_from% and %date_to%', [ '%step%' => implode(', ', $steps), diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterOnDate.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterOnDate.php index 66355e44d..c88bf1e34 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterOnDate.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterOnDate.php @@ -17,6 +17,7 @@ use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Export\Declarations; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; @@ -42,7 +43,9 @@ class StepFilterOnDate implements FilterInterface 'course.inactive_long' => AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_LONG, ]; - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatorInterface $translator) + { + } public function addRole(): ?string { @@ -101,7 +104,10 @@ class StepFilterOnDate implements FilterInterface public function describeAction($data, $format = 'string') { - $steps = array_map(fn (string $step) => $this->translator->trans(array_flip(self::STEPS)[$step]), $data['accepted_steps_multi']); + $steps = array_map( + fn (string $step) => $this->translator->trans(array_flip(self::STEPS)[$step]), + $data['accepted_steps_multi'] instanceof Collection ? $data['accepted_steps_multi']->toArray() : $data['accepted_steps_multi'] + ); return ['Filtered by steps: only %step%', [ '%step%' => implode(', ', $steps), diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php index 3c6c12c63..d6bc25198 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php @@ -30,7 +30,8 @@ class UserJobFilter implements FilterInterface public function __construct( private readonly TranslatableStringHelper $translatableStringHelper, private readonly UserJobRepositoryInterface $userJobRepository, - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php index e7ed194f1..bfbe8e66d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php @@ -30,7 +30,8 @@ class UserScopeFilter implements FilterInterface public function __construct( private readonly ScopeRepositoryInterface $scopeRepository, private readonly TranslatableStringHelper $translatableStringHelper, - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserWorkingOnCourseFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserWorkingOnCourseFilter.php index 42bb7dea3..af7674570 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserWorkingOnCourseFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserWorkingOnCourseFilter.php @@ -20,6 +20,7 @@ use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\MainBundle\Templating\Entity\UserRender; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Export\Declarations; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -33,7 +34,8 @@ final readonly class UserWorkingOnCourseFilter implements FilterInterface public function __construct( private UserRender $userRender, private RollingDateConverterInterface $rollingDateConverter, - ) {} + ) { + } public function buildForm(FormBuilderInterface $builder): void { @@ -72,7 +74,7 @@ final readonly class UserWorkingOnCourseFilter implements FilterInterface ', ', array_map( fn (User $u) => $this->userRender->renderString($u, []), - $data['users'] + $data['users'] instanceof Collection ? $data['users']->toArray() : $data['users'] ) ), '%start_date%' => $this->rollingDateConverter->convert($data['start_date'])?->format('d-m-Y'), diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByEndDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByEndDateFilter.php index a0d8d0033..3bb8eb417 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByEndDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByEndDateFilter.php @@ -21,7 +21,9 @@ use Symfony\Component\Form\FormBuilderInterface; class ByEndDateFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByStartDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByStartDateFilter.php index 401cd79a5..8c46fbfc2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByStartDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/ByStartDateFilter.php @@ -21,7 +21,9 @@ use Symfony\Component\Form\FormBuilderInterface; class ByStartDateFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php index eed856985..fce1600d1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php @@ -15,14 +15,16 @@ use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\SocialWork\Evaluation; use Chill\PersonBundle\Export\Declarations; -use Doctrine\ORM\Query\Expr\Andx; +use Chill\PersonBundle\Repository\SocialWork\EvaluationRepositoryInterface; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; final readonly class EvaluationTypeFilter implements FilterInterface { - public function __construct(private TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private TranslatableStringHelper $translatableStringHelper, private EvaluationRepositoryInterface $evaluationRepository) + { + } public function addRole(): ?string { @@ -31,16 +33,9 @@ final readonly class EvaluationTypeFilter implements FilterInterface 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 { - $where = $qb->expr()->andX($clause); - } - - $qb->add('where', $where); + $qb->andWhere( + $qb->expr()->in('workeval.evaluation', ':evaluationtype') + ); $qb->setParameter('evaluationtype', $data['accepted_evaluationtype']); } @@ -51,11 +46,17 @@ final readonly class EvaluationTypeFilter implements FilterInterface public function buildForm(FormBuilderInterface $builder) { + $evaluations = $this->evaluationRepository->findAllActive(); + + usort($evaluations, fn (Evaluation $a, Evaluation $b) => $this->translatableStringHelper->localize($a->getTitle()) <=> $this->translatableStringHelper->localize($b->getTitle())); + $builder->add('accepted_evaluationtype', EntityType::class, [ 'class' => Evaluation::class, + 'choices' => $evaluations, 'choice_label' => fn (Evaluation $ev): string => $this->translatableStringHelper->localize($ev->getTitle()), 'multiple' => true, - 'expanded' => true, + 'expanded' => false, + 'attr' => ['class' => 'select2'], ]); } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php index 6094d56ee..8555fbac9 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php @@ -25,7 +25,9 @@ class MaxDateFilter implements FilterInterface 'maxdate is not specified' => false, ]; - public function __construct(private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatorInterface $translator) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php index 733e41480..c35b9cc69 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php @@ -28,7 +28,8 @@ readonly class CompositionFilter implements FilterInterface public function __construct( private TranslatableStringHelper $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AddressRefStatusFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AddressRefStatusFilter.php index 8cd675abe..7c79f473a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AddressRefStatusFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AddressRefStatusFilter.php @@ -23,7 +23,9 @@ use Symfony\Component\Form\FormBuilderInterface; class AddressRefStatusFilter implements \Chill\MainBundle\Export\FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php index aa97ad54c..1c34f90ee 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php @@ -25,7 +25,9 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class AgeFilter implements ExportElementValidatedInterface, FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php index dd14c71ef..45d190eee 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php @@ -24,7 +24,9 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class BirthdateFilter implements ExportElementValidatedInterface, FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php index fdd799ab9..77f4f758f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php @@ -21,6 +21,7 @@ use Chill\PersonBundle\Entity\Household\HouseholdCompositionType; use Chill\PersonBundle\Entity\Household\HouseholdMember; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Repository\Household\HouseholdCompositionTypeRepositoryInterface; +use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; @@ -28,7 +29,9 @@ use Symfony\Component\Form\FormBuilderInterface; class ByHouseholdCompositionFilter implements FilterInterface { - public function __construct(private readonly HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} + public function __construct(private readonly HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatableStringHelperInterface $translatableStringHelper) + { + } public function addRole(): ?string { @@ -84,7 +87,7 @@ class ByHouseholdCompositionFilter implements FilterInterface { $compos = array_map( fn (HouseholdCompositionType $compositionType) => $this->translatableStringHelper->localize($compositionType->getLabel()), - $data['compositions']->toArray() + $data['compositions'] instanceof Collection ? $data['compositions']->toArray() : $data['compositions'] ); return ['export.filter.person.by_composition.Filtered by composition at %date%: only %compositions%', [ diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php index 82cda25ed..3cbd46a7b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php @@ -23,7 +23,9 @@ use Symfony\Component\Form\FormBuilderInterface; class DeadOrAliveFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php index 1bc32d9bb..8caf64fbf 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php @@ -24,7 +24,9 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class DeathdateFilter implements ExportElementValidatedInterface, FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GenderFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GenderFilter.php index 12ab0ad02..5009e37d0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GenderFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GenderFilter.php @@ -77,6 +77,7 @@ class GenderFilter implements 'Woman' => Person::FEMALE_GENDER, 'Man' => Person::MALE_GENDER, 'Both' => Person::BOTH_GENDER, + 'Unknown' => Person::NO_INFORMATION, 'Not given' => 'null', ], 'multiple' => true, diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GeographicalUnitFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GeographicalUnitFilter.php index d54842b47..a0aefe75b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GeographicalUnitFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GeographicalUnitFilter.php @@ -20,13 +20,16 @@ use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress; use Chill\PersonBundle\Export\Declarations; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; class GeographicalUnitFilter implements \Chill\MainBundle\Export\FilterInterface { - public function __construct(private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { @@ -102,7 +105,7 @@ class GeographicalUnitFilter implements \Chill\MainBundle\Export\FilterInterface ', ', array_map( fn (SimpleGeographicalUnitDTO $item) => $this->translatableStringHelper->localize($this->geographicalUnitLayerRepository->find($item->layerId)->getName()).' > '.$item->unitName, - $data['units'] + $data['units'] instanceof Collection ? $data['units']->toArray() : $data['units'] ) ), ], diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php index 6c4cdf802..d6af8204d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php @@ -19,7 +19,9 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType; class MaritalStatusFilter implements FilterInterface { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php index 4c83fafe3..556be8188 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php @@ -26,7 +26,9 @@ class NationalityFilter implements ExportElementValidatedInterface, FilterInterface { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php index ea8e01baf..ff511fe91 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php @@ -26,7 +26,9 @@ use Symfony\Component\Form\FormBuilderInterface; class ResidentialAddressAtThirdpartyFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php index 3c2d7a3a6..acd5ede84 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php @@ -23,7 +23,9 @@ use Doctrine\ORM\QueryBuilder; class ResidentialAddressAtUserFilter implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutHouseholdComposition.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutHouseholdComposition.php index c34c7eb40..079040b7f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutHouseholdComposition.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutHouseholdComposition.php @@ -24,7 +24,9 @@ use Symfony\Component\Form\FormBuilderInterface; class WithoutHouseholdComposition implements FilterInterface { - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkEndDateBetweenDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkEndDateBetweenDateFilter.php index 373572e54..92258ccf9 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkEndDateBetweenDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkEndDateBetweenDateFilter.php @@ -24,7 +24,8 @@ final readonly class AccompanyingPeriodWorkEndDateBetweenDateFilter implements F { public function __construct( private RollingDateConverterInterface $rollingDateConverter, - ) {} + ) { + } public function buildForm(FormBuilderInterface $builder): void { @@ -54,7 +55,7 @@ final readonly class AccompanyingPeriodWorkEndDateBetweenDateFilter implements F public function describeAction($data, $format = 'string'): array { return [ - 'export.filter.work.end_between_dates.Only where end date is between %endDate% and %endDate%', + 'export.filter.work.end_between_dates.Only where start date is between %startDate% and %endDate%', [ '%startDate%' => null !== $data['start_date'] ? $this->rollingDateConverter->convert($data['start_date'])->format('d-m-Y') : '', '%endDate%' => null !== $data['end_date'] ? $this->rollingDateConverter->convert($data['end_date'])->format('d-m-Y') : '', diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkStartDateBetweenDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkStartDateBetweenDateFilter.php index 880543355..7b404796e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkStartDateBetweenDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/AccompanyingPeriodWorkStartDateBetweenDateFilter.php @@ -24,7 +24,8 @@ final readonly class AccompanyingPeriodWorkStartDateBetweenDateFilter implements { public function __construct( private RollingDateConverterInterface $rollingDateConverter, - ) {} + ) { + } public function buildForm(FormBuilderInterface $builder): void { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorFilter.php new file mode 100644 index 000000000..c990e658e --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorFilter.php @@ -0,0 +1,81 @@ +leftJoin('acpw.createdBy', "{$p}_creator") + ->andWhere($qb->expr()->in("{$p}_creator", ":{$p}_creators")) + ->setParameter("{$p}_creators", $data['creators']); + } + + public function applyOn(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('creators', PickUserDynamicType::class, [ + 'multiple' => true, + 'label' => 'export.filter.work.by_creator.Creators', + ]); + } + + public function describeAction($data, $format = 'string'): array + { + return [ + 'export.filter.work.by_creator.Filtered by creator: only %creators%', [ + '%creators%' => implode( + ', ', + array_map( + static fn (User $u) => $u->getLabel(), + $data['creators'] instanceof Collection ? $data['creators']->toArray() : $data['creators'] + ) + ), + ], + ]; + } + + public function getFormDefaultData(): array + { + return [ + 'creators' => [], + ]; + } + + public function getTitle(): string + { + return 'export.filter.work.by_creator.title'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorJobFilter.php new file mode 100644 index 000000000..d413cdb37 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorJobFilter.php @@ -0,0 +1,108 @@ +leftJoin( + UserJobHistory::class, + "{$p}_history", + Join::WITH, + $qb->expr()->andX( + $qb->expr()->eq("{$p}_history.user", 'acpw.createdBy'), + $qb->expr()->andX( + $qb->expr()->lte("{$p}_history.startDate", 'acpw.createdAt'), + $qb->expr()->orX( + $qb->expr()->isNull("{$p}_history.endDate"), + $qb->expr()->gt("{$p}_history.endDate", 'acpw.createdAt') + ) + ) + ) + ) + ->andWhere($qb->expr()->in("{$p}_history.job", ":{$p}_jobs")) + ->setParameter("{$p}_jobs", $data['jobs']); + } + + public function applyOn(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('jobs', EntityType::class, [ + 'class' => UserJob::class, + 'choices' => $this->userJobRepository->findAllActive(), + 'multiple' => true, + 'expanded' => true, + 'choice_label' => fn (UserJob $job) => $this->translatableStringHelper->localize($job->getLabel()), + 'label' => 'Job', + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $creatorJobs = []; + + foreach ($data['jobs'] as $j) { + $creatorJobs[] = $this->translatableStringHelper->localize( + $j->getLabel() + ); + } + + return ['export.filter.work.by_creator_job.Filtered by creator job: only %jobs%', [ + '%jobs%' => implode(', ', $creatorJobs), + ]]; + } + + public function getFormDefaultData(): array + { + return [ + 'jobs' => [], + ]; + } + + public function getTitle(): string + { + return 'export.filter.work.by_creator_job.title'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorScopeFilter.php new file mode 100644 index 000000000..cedae69f6 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorScopeFilter.php @@ -0,0 +1,108 @@ +leftJoin( + UserScopeHistory::class, + "{$p}_history", + Join::WITH, + $qb->expr()->andX( + $qb->expr()->eq("{$p}_history.user", 'acpw.createdBy'), + $qb->expr()->andX( + $qb->expr()->lte("{$p}_history.startDate", 'acpw.createdAt'), + $qb->expr()->orX( + $qb->expr()->isNull("{$p}_history.endDate"), + $qb->expr()->gt("{$p}_history.endDate", 'acpw.createdAt') + ) + ) + ) + ) + ->andWhere($qb->expr()->in("{$p}_history.scope", ":{$p}_scopes")) + ->setParameter("{$p}_scopes", $data['scopes']); + } + + public function applyOn(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('scopes', EntityType::class, [ + 'class' => Scope::class, + 'choices' => $this->scopeRepository->findAllActive(), + 'choice_label' => fn (Scope $s) => $this->translatableStringHelper->localize($s->getName()), + 'multiple' => true, + 'expanded' => true, + 'label' => 'Scope', + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $creatorScopes = []; + + foreach ($data['scopes'] as $s) { + $creatorScopes[] = $this->translatableStringHelper->localize( + $s->getName() + ); + } + + return ['export.filter.work.by_creator_scope.Filtered by creator scope: only %scopes%', [ + '%scopes%' => implode(', ', $creatorScopes), + ]]; + } + + public function getFormDefaultData(): array + { + return [ + 'scopes' => [], + ]; + } + + public function getTitle(): string + { + return 'export.filter.work.by_creator_scope.title'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php index d3e54f2a5..4622f61f9 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php @@ -29,7 +29,8 @@ class JobFilter implements FilterInterface public function __construct( protected TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php index 4d456fdb2..3997139c2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php @@ -24,7 +24,9 @@ final readonly class ReferrerFilter implements FilterInterface { private const PREFIX = 'acpw_referrer_filter'; - public function __construct(private RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private RollingDateConverterInterface $rollingDateConverter) + { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php index d4867a884..2569c3d5b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php @@ -29,7 +29,8 @@ class ScopeFilter implements FilterInterface public function __construct( protected TranslatorInterface $translator, private readonly TranslatableStringHelper $translatableStringHelper - ) {} + ) { + } public function addRole(): ?string { diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php index 3476bc33e..7204e6e11 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php @@ -26,7 +26,9 @@ use Symfony\Component\Form\FormBuilderInterface; class SocialWorkTypeFilter implements FilterInterface { - public function __construct(private readonly SocialActionRender $socialActionRender, private readonly TranslatableStringHelper $translatableStringHelper, private readonly EntityManagerInterface $em) {} + public function __construct(private readonly SocialActionRender $socialActionRender, private readonly TranslatableStringHelper $translatableStringHelper, private readonly EntityManagerInterface $em) + { + } public function addRole(): ?string { @@ -144,6 +146,9 @@ class SocialWorkTypeFilter implements FilterInterface $ids = []; foreach ($asIterable as $value) { + if (null === $value) { + continue; + } $ids[] = $value->getId(); } diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/FilterListAccompanyingPeriodHelper.php b/src/Bundle/ChillPersonBundle/Export/Helper/FilterListAccompanyingPeriodHelper.php new file mode 100644 index 000000000..2c42d931f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Helper/FilterListAccompanyingPeriodHelper.php @@ -0,0 +1,105 @@ +filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; + } + + public function addFilterAccompanyingPeriods(QueryBuilder &$qb, array $requiredModifiers, array $acl, array $data = []): void + { + $centers = match ($this->filterStatsByCenters) { + true => array_map(static fn ($el) => $el['center'], $acl), + false => $this->centerRepository->findAll(), + }; + + $user = $this->security->getUser(); + + if (!$user instanceof User) { + throw new \RuntimeException('only a regular user can run this export'); + } + + // add filtering on confidential accompanying period. The confidential is applyed on the current status of + // the accompanying period (we do not use the 'calc_date' here + $aclConditionsOrX = $qb->expr()->orX( + // either the current user is the refferer for the course + 'acp.user = :list_acp_current_user', + ); + $qb->setParameter('list_acp_current_user', $user); + + $i = 0; + foreach ($centers as $center) { + $scopes = $this->authorizationHelperForCurrentUser->getReachableScopes(AccompanyingPeriodVoter::SEE_DETAILS, $center); + $scopesConfidential = + $this->authorizationHelperForCurrentUser->getReachableScopes(AccompanyingPeriodVoter::SEE_CONFIDENTIAL_ALL, $center); + $orScopes = $qb->expr()->orX(); + + foreach ($scopes as $scope) { + $scopeCondition = match (in_array($scope, $scopesConfidential, true)) { + true => ":scope_{$i} MEMBER OF acp.scopes", + false => $qb->expr()->andX( + 'acp.confidential = FALSE', + ":scope_{$i} MEMBER OF acp.scopes", + ), + }; + + $orScopes->add($scopeCondition); + $qb->setParameter("scope_{$i}", $scope); + ++$i; + } + + if ($this->filterStatsByCenters) { + $andX = $qb->expr()->andX( + $qb->expr()->exists( + 'SELECT 1 FROM '.AccompanyingPeriodParticipation::class." acl_count_part_{$i} + JOIN ".PersonCenterHistory::class." acl_count_person_history_{$i} WITH IDENTITY(acl_count_person_history_{$i}.person) = IDENTITY(acl_count_part_{$i}.person) + WHERE acl_count_part_{$i}.accompanyingPeriod = acp.id AND acl_count_person_history_{$i}.center IN (:authorized_center_{$i}) + AND acl_count_person_history_{$i}.startDate <= CURRENT_DATE() AND (acl_count_person_history_{$i}.endDate IS NULL or acl_count_person_history_{$i}.endDate > CURRENT_DATE()) + " + ), + $orScopes, + ); + $qb->setParameter('authorized_center_'.$i, $center); + $aclConditionsOrX->add($andX); + } else { + $aclConditionsOrX->add($orScopes); + } + + ++$i; + } + + $qb->andWhere($aclConditionsOrX); + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Helper/FilterListAccompanyingPeriodHelperInterface.php b/src/Bundle/ChillPersonBundle/Export/Helper/FilterListAccompanyingPeriodHelperInterface.php new file mode 100644 index 000000000..cde6aceec --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Helper/FilterListAccompanyingPeriodHelperInterface.php @@ -0,0 +1,23 @@ +add('content', ChillTextareaType::class, [ 'required' => false, + 'empty_data' => '', ]); } diff --git a/src/Bundle/ChillPersonBundle/Form/ClosingMotiveType.php b/src/Bundle/ChillPersonBundle/Form/ClosingMotiveType.php index fd7ef3ecb..5116ff1b0 100644 --- a/src/Bundle/ChillPersonBundle/Form/ClosingMotiveType.php +++ b/src/Bundle/ChillPersonBundle/Form/ClosingMotiveType.php @@ -26,7 +26,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class ClosingMotiveType extends AbstractType { - public function __construct(private readonly TranslatorInterface $translator) {} + public function __construct(private readonly TranslatorInterface $translator) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionType.php b/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionType.php index 2df66039f..0fe60cbe9 100644 --- a/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionType.php +++ b/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionType.php @@ -22,7 +22,9 @@ use Symfony\Component\Form\FormBuilderInterface; class HouseholdCompositionType extends AbstractType { - public function __construct(private readonly HouseholdCompositionTypeRepository $householdCompositionTypeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} + public function __construct(private readonly HouseholdCompositionTypeRepository $householdCompositionTypeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php index 2063b0e21..a4946b52d 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php @@ -29,7 +29,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class PersonResourceType extends AbstractType { - public function __construct(private readonly ResourceKindRender $resourceKindRender, private readonly PersonRenderInterface $personRender, private readonly ThirdPartyRender $thirdPartyRender, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly ResourceKindRender $resourceKindRender, private readonly PersonRenderInterface $personRender, private readonly ThirdPartyRender $thirdPartyRender, private readonly TranslatorInterface $translator) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php index 0d7a3bb4b..cce3ca46d 100644 --- a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialIssueType.php @@ -23,7 +23,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class SocialIssueType extends AbstractType { - public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper) {} + public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php b/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php index 6d983be37..17aad8bd0 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php @@ -21,7 +21,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PersonAltNameType extends AbstractType { - public function __construct(private readonly ConfigPersonAltNamesHelper $configHelper, private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private readonly ConfigPersonAltNamesHelper $configHelper, private readonly TranslatableStringHelper $translatableStringHelper) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php index 0e84bfc83..a55721011 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php @@ -24,7 +24,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PersonPhoneType extends AbstractType { - public function __construct(private readonly PhonenumberHelper $phonenumberHelper, private readonly EntityManagerInterface $em) {} + public function __construct(private readonly PhonenumberHelper $phonenumberHelper, private readonly EntityManagerInterface $em) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php b/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php index c14472cdd..440b6568c 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PickPersonDynamicType.php @@ -26,7 +26,9 @@ use Symfony\Component\Serializer\SerializerInterface; */ class PickPersonDynamicType extends AbstractType { - public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly NormalizerInterface $normalizer) {} + public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly NormalizerInterface $normalizer) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PickSocialActionType.php b/src/Bundle/ChillPersonBundle/Form/Type/PickSocialActionType.php index 19258f23d..0fe09e56a 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PickSocialActionType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PickSocialActionType.php @@ -20,7 +20,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickSocialActionType extends AbstractType { - public function __construct(private readonly SocialActionRender $actionRender, private readonly SocialActionRepository $actionRepository) {} + public function __construct(private readonly SocialActionRender $actionRender, private readonly SocialActionRepository $actionRepository) + { + } public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PickSocialIssueType.php b/src/Bundle/ChillPersonBundle/Form/Type/PickSocialIssueType.php index b61343423..3e6ae1e97 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PickSocialIssueType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PickSocialIssueType.php @@ -20,7 +20,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PickSocialIssueType extends AbstractType { - public function __construct(private readonly SocialIssueRender $issueRender, private readonly SocialIssueRepository $issueRepository) {} + public function __construct(private readonly SocialIssueRender $issueRender, private readonly SocialIssueRepository $issueRepository) + { + } public function configureOptions(OptionsResolver $resolver) { diff --git a/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php b/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php index b820aa86f..c33244635 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php @@ -25,17 +25,19 @@ use Symfony\Component\OptionsResolver\OptionsResolver; */ class Select2MaritalStatusType extends AbstractType { - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly EntityManagerInterface $em) {} + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly EntityManagerInterface $em) + { + } public function buildForm(FormBuilderInterface $builder, array $options) { - $transformer = new ObjectToIdTransformer($this->em, \Chill\PersonBundle\Entity\MaritalStatus::class); + $transformer = new ObjectToIdTransformer($this->em, MaritalStatus::class); $builder->addModelTransformer($transformer); } public function configureOptions(OptionsResolver $resolver) { - $maritalStatuses = $this->em->getRepository(\Chill\PersonBundle\Entity\MaritalStatus::class)->findAll(); + $maritalStatuses = $this->em->getRepository(MaritalStatus::class)->findAll(); $choices = []; foreach ($maritalStatuses as $ms) { diff --git a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php index 3f89202e1..c4be4ba5e 100644 --- a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php +++ b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php @@ -42,7 +42,8 @@ class MembersEditor private readonly ValidatorInterface $validator, private readonly ?Household $household, private readonly EventDispatcherInterface $eventDispatcher - ) {} + ) { + } /** * Add a person to the household. diff --git a/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php b/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php index 7f98fe120..16e25bc63 100644 --- a/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php +++ b/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php @@ -17,7 +17,9 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; class MembersEditorFactory { - public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly ValidatorInterface $validator) {} + public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly ValidatorInterface $validator) + { + } public function createEditor(Household $household = null): MembersEditor { diff --git a/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php index c82038b40..870f021f5 100644 --- a/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php @@ -28,7 +28,9 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface /** * SectionMenuBuilder constructor. */ - public function __construct(protected ParameterBagInterface $parameterBag, private readonly Security $security, protected TranslatorInterface $translator) {} + public function __construct(protected ParameterBagInterface $parameterBag, private readonly Security $security, protected TranslatorInterface $translator) + { + } public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationHandler.php b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationHandler.php index 668f868ae..4f1146391 100644 --- a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationHandler.php +++ b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationHandler.php @@ -18,7 +18,9 @@ use Chill\PersonBundle\Repository\AccompanyingPeriodRepository; final readonly class AccompanyingPeriodNotificationHandler implements NotificationHandlerInterface { - public function __construct(private AccompanyingPeriodRepository $accompanyingPeriodRepository) {} + public function __construct(private AccompanyingPeriodRepository $accompanyingPeriodRepository) + { + } public function getTemplate(Notification $notification, array $options = []): string { diff --git a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkEvaluationDocumentNotificationHandler.php b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkEvaluationDocumentNotificationHandler.php index 40aff8570..f69c49071 100644 --- a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkEvaluationDocumentNotificationHandler.php +++ b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkEvaluationDocumentNotificationHandler.php @@ -18,7 +18,9 @@ use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkEvalu final readonly class AccompanyingPeriodWorkEvaluationDocumentNotificationHandler implements NotificationHandlerInterface { - public function __construct(private AccompanyingPeriodWorkEvaluationDocumentRepository $accompanyingPeriodWorkEvaluationDocumentRepository) {} + public function __construct(private AccompanyingPeriodWorkEvaluationDocumentRepository $accompanyingPeriodWorkEvaluationDocumentRepository) + { + } public function getTemplate(Notification $notification, array $options = []): string { diff --git a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkNotificationHandler.php b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkNotificationHandler.php index e147fa520..abb8123bc 100644 --- a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkNotificationHandler.php +++ b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkNotificationHandler.php @@ -18,7 +18,9 @@ use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepos final readonly class AccompanyingPeriodWorkNotificationHandler implements NotificationHandlerInterface { - public function __construct(private AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository) {} + public function __construct(private AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository) + { + } public function getTemplate(Notification $notification, array $options = []): string { diff --git a/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php b/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php index 739387941..f6619317f 100644 --- a/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php +++ b/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php @@ -37,7 +37,9 @@ class AccompanyingPeriodPrivacyEvent extends \Symfony\Contracts\EventDispatcher\ { final public const ACCOMPANYING_PERIOD_PRIVACY_EVENT = 'chill_person.accompanying_period_privacy_event'; - public function __construct(protected $period, protected $args = []) {} + public function __construct(protected $period, protected $args = []) + { + } public function getArgs(): array { diff --git a/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php b/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php index df57a08fd..4e728c635 100644 --- a/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php +++ b/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php @@ -48,7 +48,9 @@ class PrivacyEvent extends \Symfony\Contracts\EventDispatcher\Event /** * PrivacyEvent constructor. */ - public function __construct(private readonly Person $person, private readonly array $args = ['action' => 'show']) {} + public function __construct(private readonly Person $person, private readonly array $args = ['action' => 'show']) + { + } public function addPerson(Person $person) { diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php index 0a43697c8..b50a1b18e 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php @@ -40,7 +40,8 @@ final readonly class AccompanyingPeriodACLAwareRepository implements Accompanyin private Security $security, private AuthorizationHelperForCurrentUserInterface $authorizationHelper, private CenterResolverManagerInterface $centerResolver - ) {} + ) { + } public function buildQueryOpenedAccompanyingCourseByUserAndPostalCodes(?User $user, array $postalCodes = []): QueryBuilder { diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php index 26121ffdc..6460ba958 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php @@ -21,7 +21,9 @@ use Symfony\Component\Security\Core\Security; final readonly class HouseholdACLAwareRepository implements HouseholdACLAwareRepositoryInterface { - public function __construct(private EntityManagerInterface $em, private AuthorizationHelper $authorizationHelper, private Security $security) {} + public function __construct(private EntityManagerInterface $em, private AuthorizationHelper $authorizationHelper, private Security $security) + { + } public function addACL(QueryBuilder $qb, string $alias = 'h'): QueryBuilder { diff --git a/src/Bundle/ChillPersonBundle/Repository/Person/PersonCenterHistoryInterface.php b/src/Bundle/ChillPersonBundle/Repository/Person/PersonCenterHistoryInterface.php index fc5d0606d..c1bb427fd 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Person/PersonCenterHistoryInterface.php +++ b/src/Bundle/ChillPersonBundle/Repository/Person/PersonCenterHistoryInterface.php @@ -13,4 +13,6 @@ namespace Chill\PersonBundle\Repository\Person; use Doctrine\Persistence\ObjectRepository; -interface PersonCenterHistoryInterface extends ObjectRepository {} +interface PersonCenterHistoryInterface extends ObjectRepository +{ +} diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php index 0b6b96339..7b6010718 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php @@ -25,7 +25,9 @@ use Symfony\Component\Security\Core\Security; final readonly class PersonACLAwareRepository implements PersonACLAwareRepositoryInterface { - public function __construct(private Security $security, private EntityManagerInterface $em, private CountryRepository $countryRepository, private AuthorizationHelperInterface $authorizationHelper) {} + public function __construct(private Security $security, private EntityManagerInterface $em, private CountryRepository $countryRepository, private AuthorizationHelperInterface $authorizationHelper) + { + } public function buildAuthorizedQuery( string $default = null, diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/App.vue index d4d1be1b6..3b23ab0ad 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/App.vue @@ -1,11 +1,10 @@ \ No newline at end of file + diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/api.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/api.js index afcece4f4..0c02c21f0 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/api.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/api.js @@ -8,29 +8,17 @@ const getSocialActions = () => fetchResults( const getGoalByAction = (id) => { let url = `/api/1.0/person/social-work/goal/by-social-action/${id}.json`; - return fetch(url) - .then(response => { - if (response.ok) { return response.json(); } - throw Error('Error with request resource response'); - }); + return fetchResults(url); }; const getResultByAction = (id) => { let url = `/api/1.0/person/social-work/result/by-social-action/${id}.json`; - return fetch(url) - .then(response => { - if (response.ok) { return response.json(); } - throw Error('Error with request resource response'); - }); + return fetchResults(url); }; const getResultByGoal = (id) => { let url = `/api/1.0/person/social-work/result/by-goal/${id}.json`; - return fetch(url) - .then(response => { - if (response.ok) { return response.json(); } - throw Error('Error with request resource response'); - }); + return fetchResults(url); }; export { @@ -38,4 +26,4 @@ export { getGoalByAction, getResultByAction, getResultByGoal, -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/index.js index d838fb0be..191f42863 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/index.js @@ -2,12 +2,15 @@ import { createApp } from "vue"; import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'; import App from './App.vue'; -const i18n = _createI18n({}); +if (null !== document.getElementById('export_filters_social_work_type_filter_enabled')) { + const i18n = _createI18n({}); + const form = document.getElementById('export_filters_social_work_type_filter_form'); + const after = form.appendChild(document.createElement('div')); -const app = createApp({ - template: ``, -}) -.use(i18n) -.component('app', App) -.mount('#export_export') -; \ No newline at end of file + const app = createApp({ + template: ``, + }) + .use(i18n) + .component('app', App) + .mount(after); +} diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/i18n.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/i18n.js index cee841d0c..474788f47 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/i18n.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/i18n.js @@ -12,7 +12,7 @@ const visMessages = { Holder: 'Titulaire', Legend: 'Calques', concerned: 'concerné', - both: 'neutre, non binaire', + // both: 'neutre, non binaire', woman: 'féminin', man: 'masculin', undefined: "genre non précisé", @@ -64,8 +64,9 @@ const visMessages = { placeholder: "Choisissez le genre de l'usager", woman: "Féminin", man: "Masculin", - neuter: "Neutre, non binaire", - undefined: "Non renseigné" + both: "Neutre, non binaire", + undefined: "Non renseigné", + unknown: "Non renseigné" } }, error_only_one_person: "Une seule personne peut être sélectionnée !", diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/vis-network.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/vis-network.js index 6f9a2ac16..cb37c3661 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/vis-network.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/vis-network.js @@ -153,6 +153,8 @@ const getGender = (gender) => { return visMessages.fr.visgraph.woman case 'man': return visMessages.fr.visgraph.man + case 'unknown': + return visMessages.fr.visgraph.unknown default: return visMessages.fr.visgraph.undefined } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue index ca9385990..100dc9caf 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue @@ -81,7 +81,7 @@
  • {{ $t('renderbox.no_data') }}

  • - +