diff --git a/.changes/v2.23.0.md b/.changes/v2.23.0.md index 47f36fa51..5987b1ca8 100644 --- a/.changes/v2.23.0.md +++ b/.changes/v2.23.0.md @@ -1,5 +1,11 @@ -## v2.23.0 - 2024-07-19 +## v2.23.0 - 2024-07-23 & 2024-07-19 ### Feature +* ([#221](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/221)) [DX] move async-upload-bundle features into chill-bundles +* Add job bundle (module emploi) +* Upgrade import of address list to the last version of compiled addresses of belgian-best-address + +* Upgrade CKEditor and refactor configuration with use of typescript + * ([#123](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/123)) Add a button to duplicate calendar ranges from a week to another one * [admin] filter users by active / inactive in the admin user's list * ([#273](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/273)) Add the possibility to mark all notifications as read @@ -9,6 +15,8 @@ * Do not update the "createdAt" column when importing postal code which does not change * Display filename on file upload within the UI interface ### Fixed +* Fix resolving of centers for an household, which will fix in turn the access control +* Resolved type hinting error in activity list export * ([#271](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/271)) Take into account the acp closing date in the acp works date filter ### Traduction française des principaux changements diff --git a/.changes/v3.0.0.md b/.changes/v3.0.0.md new file mode 100644 index 000000000..586e648da --- /dev/null +++ b/.changes/v3.0.0.md @@ -0,0 +1,5 @@ +## v3.0.0 - 2024-08-26 +### Fixed +* Fix delete action for accompanying periods in draft state +* Fix connection to azure when making an calendar event in chill +* CollectionType js fixes for remove button and adding multiple entries diff --git a/.changes/v3.1.0.md b/.changes/v3.1.0.md new file mode 100644 index 000000000..cb05f47fb --- /dev/null +++ b/.changes/v3.1.0.md @@ -0,0 +1,3 @@ +## v3.1.0 - 2024-08-30 +### Feature +* Add export aggregator to aggregate activities by household + filter persons that are not part of an accompanyingperiod during a certain timeframe. diff --git a/.env b/.env new file mode 100644 index 000000000..1714966d4 --- /dev/null +++ b/.env @@ -0,0 +1,94 @@ +# * .env contains default values for the environment variables needed by the app +# * .env.local uncommitted file with local overrides +# * .env.$APP_ENV committed environment-specific defaults +# * .env.$APP_ENV.local uncommitted environment-specific overrides +# +# Real environment variables win over .env files. +# +# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES. +# https://symfony.com/doc/current/configuration/secrets.html +# +# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2). +# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration + +## Locale +LOCALE=fr + +###> symfony/framework-bundle ### +# this should be set in docker-compose.yml file +APP_ENV=prod +APP_SECRET=ChangeItf2b58287ef7f9976409d3f6c72529e99ChangeIt +TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 +TRUSTED_HOSTS='^(localhost|example\.com|nginx)$' +###< symfony/framework-bundle ### + +## Wopi server for editing documents online +WOPI_SERVER=http://collabora:9980 + +# must be manually set in .env.local +# ADMIN_PASSWORD= + +###> symfony/mailer ### +# MAILER_DSN=null://null +###< symfony/mailer ### + +## Notifications +NOTIFICATION_HOST=localhost:8001 +NOTIFICATION_FROM_EMAIL=admin@chill.social +NOTIFICATION_FROM_NAME="Chill " + +## Pgadmin credential +PGADMIN_DEFAULT_EMAIL= +PGADMIN_DEFAULT_PASSWORD= + +## OVH OpenStack Storage Container +ASYNC_UPLOAD_TEMP_URL_KEY= +ASYNC_UPLOAD_TEMP_URL_BASE_PATH= +ASYNC_UPLOAD_TEMP_URL_CONTAINER= + +## Redis Cache +REDIS_HOST=redis +REDIS_PORT=6379 +REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT} + +## Twilio +TWILIO_SID=~ +TWILIO_SECRET=~ +DEFAULT_CARRIER_CODE=BE + +ADD_ADDRESS_DEFAULT_COUNTRY=BE + +ADD_ADDRESS_MAP_CENTER_X=50.8443 +ADD_ADDRESS_MAP_CENTER_Y=4.3523 +ADD_ADDRESS_MAP_CENTER_Z=15 + +SHORT_MESSAGE_DSN=null://null + +## DOCKER IMAGES REGISTRY +#IMAGE_PHP= +#IMAGE_NGINX= + +## DOCKER IMAGES TAG +#VERSION=test +#VERSION=prod + +###> symfony/messenger ### +# Choose one of the transports below +# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages +# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages +MESSENGER_TRANSPORT_DSN=sync:// +MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0 +###< symfony/messenger ### + +###> doctrine/doctrine-bundle ### +# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url +# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml +# +DATABASE_URL="postgresql://postgres:postgres@db:5432/postgres?serverVersion=14&charset=utf8" +###< doctrine/doctrine-bundle ### + +###> lexik/jwt-authentication-bundle ### +JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem +JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem +JWT_PASSPHRASE=2a30f6ba26521a2613821da35f28386e +###< lexik/jwt-authentication-bundle ### diff --git a/.env.test b/.env.test index 9245579c0..f84920e54 100644 --- a/.env.test +++ b/.env.test @@ -4,6 +4,8 @@ KERNEL_CLASS='App\Kernel' APP_SECRET='$ecretf0rt3st' +TRUSTED_HOSTS= + ADMIN_PASSWORD=password LOCALE=fr diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 43f687649..bb5c8dd5d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,6 +20,7 @@ services: # Set any variables we need variables: + APP_ENV: test GIT_DEPTH: 1 # Configure postgres environment variables (https://hub.docker.com/r/_/postgres/) POSTGRES_USER: postgres @@ -35,7 +36,7 @@ variables: # force a timezone TZ: Europe/Brussels # avoid direct deprecations (using symfony phpunit bridge: https://symfony.com/doc/4.x/components/phpunit_bridge.html#internal-deprecations - SYMFONY_DEPRECATIONS_HELPER: max[total]=99999999&max[self]=0&max[direct]=0&verbose=1 + SYMFONY_DEPRECATIONS_HELPER: max[total]=99999999&max[self]=0&max[direct]=45&verbose=0 stages: - Composer install @@ -120,7 +121,7 @@ unit_tests: - php tests/console doctrine:migrations:migrate -n --env=test - php tests/console chill:db:sync-views --env=test - php -d memory_limit=2G tests/console cache:clear --env=test - - php -d memory_limit=3G tests/console doctrine:fixtures:load -n + - php -d memory_limit=3G tests/console doctrine:fixtures:load -n --env=test - php -d memory_limit=4G bin/phpunit --colors=never --exclude-group dbIntensive artifacts: expire_in: 1 day @@ -137,4 +138,4 @@ release: - echo "running release_job" release: tag_name: '$CI_COMMIT_TAG' - description: "./.changes/v$CI_COMMIT_TAG.md" + description: "./.changes/$CI_COMMIT_TAG.md" diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 9aae1c43f..4a70e81e7 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -27,6 +27,7 @@ $config ->setRiskyAllowed(true) ->setCacheFile('.cache/php-cs-fixer.cache') ->setUsingCache(true) + ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()) ; $rules = $config->getRules(); @@ -112,6 +113,7 @@ $rules = array_merge( ], 'sort_algorithm' => 'alpha', ], + 'single_line_empty_body' => true, ], $rules, $riskyRules, diff --git a/CHANGELOG.md b/CHANGELOG.md index db735c10a..5272cd5a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,21 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## v3.1.0 - 2024-08-30 +### Feature +* Add export aggregator to aggregate activities by household + filter persons that are not part of an accompanyingperiod during a certain timeframe. + +## v3.0.0 - 2024-08-26 +### Fixed +* Fix delete action for accompanying periods in draft state +* Fix connection to azure when making an calendar event in chill +* CollectionType js fixes for remove button and adding multiple entries + ## v2.24.0 - 2024-09-11 ### Feature -* ([#306](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/306)) When a document is converted or downloaded in the browser, this document is removed from the browser memory after 45s. Future click on the button re-download the document. +* ([#306](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/306)) When a document is converted or downloaded in the browser, this document is removed from the browser memory after 45s. Future click on the button re-download the document. -## v2.23.0 - 2024-07-19 +## v2.23.0 - 2024-07-19 & 2024-07-23 ### Feature * ([#123](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/123)) Add a button to duplicate calendar ranges from a week to another one * [admin] filter users by active / inactive in the admin user's list @@ -33,15 +43,25 @@ and is generated by [Changie](https://github.com/miniscruff/changie). - Agrandit l'icône du type de fichier dans l'interface de dépôt de fichier; - correction: tient compte de la date de fermeture du parcours dans les filtres sur les actions d'accompagnement. +* ([#221](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/221)) [DX] move async-upload-bundle features into chill-bundles +* Add job bundle (module emploi) +* Upgrade import of address list to the last version of compiled addresses of belgian-best-address + +* Upgrade CKEditor and refactor configuration with use of typescript + +### Fixed +* Fix resolving of centers for an household, which will fix in turn the access control +* Resolved type hinting error in activity list export + ## v2.22.2 - 2024-07-03 ### Fixed -* Remove scope required for event participation stats +* Remove scope required for event participation stats ## v2.22.1 - 2024-07-01 ### Fixed -* Remove debug word +* Remove debug word ### DX -* Add a command for reading official address DB from Luxembourg and update chill addresses +* Add a command for reading official address DB from Luxembourg and update chill addresses ## v2.22.0 - 2024-06-25 ### Feature @@ -84,7 +104,7 @@ and is generated by [Changie](https://github.com/miniscruff/changie). ## v2.20.1 - 2024-06-05 ### Fixed -* Do not allow StoredObjectCreated for edit and convert buttons +* Do not allow StoredObjectCreated for edit and convert buttons ## v2.20.0 - 2024-06-05 ### Fixed @@ -131,96 +151,96 @@ and is generated by [Changie](https://github.com/miniscruff/changie). ## v2.18.2 - 2024-04-12 ### Fixed -* ([#250](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/250)) Postal codes import : fix the source URL and the keys to handle each record +* ([#250](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/250)) Postal codes import : fix the source URL and the keys to handle each record ## v2.18.1 - 2024-03-26 ### Fixed -* Fix layout issue in document generation for admin (minor) +* Fix layout issue in document generation for admin (minor) ## v2.18.0 - 2024-03-26 ### Feature -* ([#268](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/268)) Improve admin UX to configure document templates for document generation +* ([#268](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/268)) Improve admin UX to configure document templates for document generation ### Fixed -* ([#267](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/267)) Fix the join between job and user in the user list (admin): show only the current user job +* ([#267](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/267)) Fix the join between job and user in the user list (admin): show only the current user job ## v2.17.0 - 2024-03-19 ### Feature -* ([#237](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/237)) New export filter for social actions with an evaluation created between two dates -* ([#258](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/258)) In the list of accompangying period, add the list of person's centers and the duration of the course -* ([#238](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/238)) Allow to customize list person with new fields +* ([#237](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/237)) New export filter for social actions with an evaluation created between two dates +* ([#258](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/258)) In the list of accompangying period, add the list of person's centers and the duration of the course +* ([#238](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/238)) Allow to customize list person with new fields * ([#159](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/159)) Admin can publish news on the homepage ### Fixed -* ([#264](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/264)) Fix languages: load the languages in all availables languages configured for Chill -* ([#259](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/259)) Keep a consistent behaviour between the filtering of activities within the document generation (model "accompanying period with activities"), and the same filter in the list of activities for an accompanying period +* ([#264](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/264)) Fix languages: load the languages in all availables languages configured for Chill +* ([#259](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/259)) Keep a consistent behaviour between the filtering of activities within the document generation (model "accompanying period with activities"), and the same filter in the list of activities for an accompanying period ## v2.16.3 - 2024-02-26 ### Fixed -* ([#236](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/236)) Fix translation of user job -> 'service' must be 'métier' +* ([#236](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/236)) Fix translation of user job -> 'service' must be 'métier' ### UX -* ([#232](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/232)) Order user jobs and services alphabetically in export filters +* ([#232](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/232)) Order user jobs and services alphabetically in export filters ## v2.16.2 - 2024-02-21 ### Fixed -* Check for null values in closing motive of parcours d'accompagnement for correct rendering of template +* Check for null values in closing motive of parcours d'accompagnement for correct rendering of template ## v2.16.1 - 2024-02-09 ### Fixed -* Force bootstrap version to avoid error in builds with newer version +* Force bootstrap version to avoid error in builds with newer version ## v2.16.0 - 2024-02-08 ### Feature -* ([#231](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/231)) Create new filter for persons having a participation in an accompanying period during a certain time span -* ([#241](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/241)) [Export][List of accompanyign period] Add two columns: the list of persons participating to the period, and their ids -* ([#244](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/244)) Add capability to generate export about change of steps of accompanying period, and generate exports for this -* ([#253](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/253)) Export: group accompanying period by person participating -* ([#243](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/243)) Export: add filter for courses not linked to a reference address -* ([#229](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/229)) Allow to group activities linked with accompanying period by reason -* ([#115](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/115)) Prevent social work to be saved when another user edited conccurently the social work -* Modernize the event bundle, with some new fields and multiple improvements +* ([#231](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/231)) Create new filter for persons having a participation in an accompanying period during a certain time span +* ([#241](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/241)) [Export][List of accompanyign period] Add two columns: the list of persons participating to the period, and their ids +* ([#244](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/244)) Add capability to generate export about change of steps of accompanying period, and generate exports for this +* ([#253](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/253)) Export: group accompanying period by person participating +* ([#243](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/243)) Export: add filter for courses not linked to a reference address +* ([#229](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/229)) Allow to group activities linked with accompanying period by reason +* ([#115](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/115)) Prevent social work to be saved when another user edited conccurently the social work +* Modernize the event bundle, with some new fields and multiple improvements ### Fixed -* ([#220](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/220)) Fix error in logs about wrong typing of eventArgs in onEditNotificationComment method -* ([#256](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/256)) Fix the conditions upon which social actions should be optional or required in relation to social issues within the activity creation form +* ([#220](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/220)) Fix error in logs about wrong typing of eventArgs in onEditNotificationComment method +* ([#256](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/256)) Fix the conditions upon which social actions should be optional or required in relation to social issues within the activity creation form ### UX -* ([#260](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/260)) Order list of centers alphabetically in dropdown 'user' section admin. +* ([#260](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/260)) Order list of centers alphabetically in dropdown 'user' section admin. ## 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 +* 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. +* 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. +* 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 +* ([#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" +* ([#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) +* ([#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 + +* ([#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 +* 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 +* ([#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 +* ([#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 @@ -234,7 +254,7 @@ and is generated by [Changie](https://github.com/miniscruff/changie). ## 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" +* ([#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 @@ -265,36 +285,36 @@ and is generated by [Changie](https://github.com/miniscruff/changie). ## 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" +* ([#194](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/194)) Export: add a filter "filter activity by creator job" ### Fixed -* ([#185](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/185)) Export: fix "group accompanying period by geographical unit": take into account the accompanying periods when the period is not located within an unit -* Fix "group activity by creator job" aggregator +* ([#185](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/185)) Export: fix "group accompanying period by geographical unit": take into account the accompanying periods when the period is not located within an unit +* Fix "group activity by creator job" aggregator ## v2.10.6 - 2023-11-07 ### Fixed -* ([#182](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/182)) Fix merging of double person files. Adjustement relationship sql statement -* ([#185](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/185)) Export: fix aggregator by geographical unit on person: avoid inconsistencies +* ([#182](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/182)) Fix merging of double person files. Adjustement relationship sql statement +* ([#185](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/185)) Export: fix aggregator by geographical unit on person: avoid inconsistencies ## v2.10.5 - 2023-11-05 ### Fixed -* ([#183](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/183)) Fix "problem during download" on some filters, which used a wrong data type -* ([#184](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/184)) Fix filter "activity by date" +* ([#183](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/183)) Fix "problem during download" on some filters, which used a wrong data type +* ([#184](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/184)) Fix filter "activity by date" ## v2.10.4 - 2023-10-26 ### Fixed -* Fix null value constraint errors when merging relationships in doubles +* Fix null value constraint errors when merging relationships in doubles ## v2.10.3 - 2023-10-26 ### Fixed -* ([#175](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/175)) Replace old method of getting translator with injection of translatorInterface +* ([#175](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/175)) Replace old method of getting translator with injection of translatorInterface ## v2.10.2 - 2023-10-26 ### Fixed -* ([#175](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/175)) Use injection of translator instead of ->get(). +* ([#175](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/175)) Use injection of translator instead of ->get(). ## v2.10.1 - 2023-10-24 ### Fixed -* Fix export controller when generating an export without any data in session +* Fix export controller when generating an export without any data in session ## v2.10.0 - 2023-10-24 ### Feature @@ -319,11 +339,11 @@ and is generated by [Changie](https://github.com/miniscruff/changie). ## v2.9.2 - 2023-10-17 ### Fixed -* Fix possible null values in string's entities +* Fix possible null values in string's entities ## v2.9.1 - 2023-10-17 ### Fixed -* Fix the handling of activity form when editing or creating an activity in an accompanying period with multiple centers +* Fix the handling of activity form when editing or creating an activity in an accompanying period with multiple centers ## v2.9.0 - 2023-10-17 ### Feature @@ -371,57 +391,57 @@ But if you do not need this any more, you must ensure that the configuration key ## v2.7.0 - 2023-09-27 ### Feature -* ([#155](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/155)) The regulation list load accompanying periods by exact postal code (address associated with postal code), and not by the content of the postal code (postal code with same code's string) +* ([#155](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/155)) The regulation list load accompanying periods by exact postal code (address associated with postal code), and not by the content of the postal code (postal code with same code's string) ### Fixed -* ([#142](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/142)) Fix the label of filter ActivityTypeFilter to a more obvious one -* ([#140](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/140)) [export] Fix association of filter "filter location by type" which did not appears on "list of activities" +* ([#142](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/142)) Fix the label of filter ActivityTypeFilter to a more obvious one +* ([#140](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/140)) [export] Fix association of filter "filter location by type" which did not appears on "list of activities" ## v2.6.3 - 2023-09-19 ### Fixed -* Remove id property from document -mappedsuperclass +* Remove id property from document +mappedsuperclass ## v2.6.2 - 2023-09-18 ### Fixed -* Fix doctrine mapping of AbstractTaskPlaceEvent and SingleTaskPlaceEvent: id property moved. +* Fix doctrine mapping of AbstractTaskPlaceEvent and SingleTaskPlaceEvent: id property moved. ## v2.6.1 - 2023-09-14 ### Fixed -* Filter out active centers in exports, which uses a different PickCenterType. +* Filter out active centers in exports, which uses a different PickCenterType. ## v2.6.0 - 2023-09-14 ### Feature -* ([#133](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/133)) Add locations in Aside Activity. By default, suggest user location, otherwise a select with all locations. -* ([#133](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/133)) Adapt Aside Activity exports: display location, filter by location, group by location -* Use the CRUD controller for center entity + add the isActive property to be able to mask instances of Center that are no longer in use. +* ([#133](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/133)) Add locations in Aside Activity. By default, suggest user location, otherwise a select with all locations. +* ([#133](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/133)) Adapt Aside Activity exports: display location, filter by location, group by location +* Use the CRUD controller for center entity + add the isActive property to be able to mask instances of Center that are no longer in use. ### Fixed -* ([#107](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/107)) reinstate the fusion of duplicate persons -* Missing translation in Work Actions exports -* Reimplement the mission type filter on tasks, only for instances that have a config parameter indicating true for this. -* ([#135](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/135)) Corrects a typing error in 2 filters, which caused an +* ([#107](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/107)) reinstate the fusion of duplicate persons +* Missing translation in Work Actions exports +* Reimplement the mission type filter on tasks, only for instances that have a config parameter indicating true for this. +* ([#135](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/135)) Corrects a typing error in 2 filters, which caused an error when trying to reedit a saved export - -* ([#136](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/136)) [household] when moving a person to a sharing position to a not-sharing position on the same household on the same date, remove the previous household membership on the same household. This fix duplicate member. + +* ([#136](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/136)) [household] when moving a person to a sharing position to a not-sharing position on the same household on the same date, remove the previous household membership on the same household. This fix duplicate member. * Add missing translation for comment field placeholder in repositionning household editor. - -* Do not send an email to creator twice when adding a comment to a notification -* ([#107](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/107)) Fix gestion doublon functionality to work with chill bundles v2 + +* Do not send an email to creator twice when adding a comment to a notification +* ([#107](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/107)) Fix gestion doublon functionality to work with chill bundles v2 ### UX * Uniformize badge-person in household banner (background, size) - + ## v2.5.3 - 2023-07-20 ### Fixed -* ([#132](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/132)) Rendez-vous documents created would appear in all documents lists of all persons with an accompanying period. Or statements are now added to the where clause to filter out documents that come from unrelated accompanying period/ or person rendez-vous. +* ([#132](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/132)) Rendez-vous documents created would appear in all documents lists of all persons with an accompanying period. Or statements are now added to the where clause to filter out documents that come from unrelated accompanying period/ or person rendez-vous. ## v2.5.2 - 2023-07-15 ### Fixed -* [Collate Address] when updating address point, do not use the point's address reference if the similarity is below the requirement for associating the address reference and the address (it uses the postcode's center instead) +* [Collate Address] when updating address point, do not use the point's address reference if the similarity is below the requirement for associating the address reference and the address (it uses the postcode's center instead) ## v2.5.1 - 2023-07-14 ### Fixed -* [collate addresses] block collating addresses to another address reference where the address reference is already the best match +* [collate addresses] block collating addresses to another address reference where the address reference is already the best match ## v2.5.0 - 2023-07-14 ### Feature diff --git a/MIGRATION.md b/MIGRATION.md new file mode 100644 index 000000000..e823f0b22 --- /dev/null +++ b/MIGRATION.md @@ -0,0 +1,117 @@ + +# Switch to symfony 5.0 + +- the tag `chill.role` is now renamed to `chill_main.provide_role`. + + **Note**: It is not necessary to apply this tag on service definition: the tag is automatically applyied if the + service implements `\Chill\MainBundle\Security\ProvideRoleInterface`. + +- those annotation can be converted to attribute: + + - `Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\AccompanyingPeriodValidity` + - `Chill\PersonBundle\Validator\Constraints\Household\HouseholdMembershipSequential` + - `Chill\PersonBundle\Validator\Constraints\Household\MaxHolder` + - `Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ConfidentialCourseMustHaveReferrer` + - `Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\LocationValidity` + - `Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ParticipationOverlap` + - `Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ResourceDuplicateCheck` + - `Chill\PersonBundle\Validator\Constraints\Person\Birthdate` + - `Chill\PersonBundle\Validator\Constraints\Person\PersonHasCenter` + - `Chill\PersonBundle\Validator\Constraints\Relationship\RelationshipNoDuplicate` + - `Chill\ActivityBundle\Validator\Constraints\ActivityValidity` + - `Chill\DocStoreBundle\Validator\Constraints\AsyncFileExists` + - `Chill\MainBundle\Validation\Constraint\PhonenumberConstraint` + - `Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency` + - `Chill\MainBundle\Workflow\Validator\EntityWorkflowCreation` + + Here is the rector rule that can be used to switch attributes to annotations: + + ```php + $rectorConfig->ruleWithConfiguration(\Rector\Php80\Rector\Class_\AnnotationToAttributeRector::class, [ + new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\AccompanyingPeriodValidity'), + new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\Household\HouseholdMembershipSequential'), + new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\Household\MaxHolder'), + new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ConfidentialCourseMustHaveReferrer'), + new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\LocationValidity'), + new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ParticipationOverlap'), + new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ResourceDuplicateCheck'), + new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\Person\Birthdate'), + new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\Person\PersonHasCenter'), + new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\PersonBundle\Validator\Constraints\Relationship\RelationshipNoDuplicate'), + new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\ActivityBundle\Validator\Constraints\ActivityValidity'), + new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\DocStoreBundle\Validator\Constraints\AsyncFileExists'), + new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\MainBundle\Validation\Constraint\PhonenumberConstraint'), + new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency'), + new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\MainBundle\Workflow\Validator\EntityWorkflowCreation'), + ]); + ``` + +- to keep cleaner definition in container's dependency injection and framework bundle, the definition of crud or api + requires to define explicitly a controller. + + Before: + + ```php + $container->prependExtensionConfig('chill_main', [ + 'apis' => [ + [ + 'class' => ThirdParty::class, + 'name' => 'thirdparty', + 'base_path' => '/api/1.0/thirdparty/thirdparty', + 'actions' => [ + '_entity' => [ + 'methods' => [ + Request::METHOD_GET => true, + Request::METHOD_HEAD => true, + Request::METHOD_POST => true, + Request::METHOD_PUT => true, + Request::METHOD_PATCH => true, + ], + 'roles' => [ + Request::METHOD_GET => ThirdPartyVoter::SHOW, + Request::METHOD_HEAD => ThirdPartyVoter::SHOW, + Request::METHOD_POST => ThirdPartyVoter::CREATE, + Request::METHOD_PUT => ThirdPartyVoter::CREATE, + Request::METHOD_PATCH => ThirdPartyVoter::CREATE, + ], + ], + ], + ], + ], + ]); + + After: + + ```php + $container->prependExtensionConfig('chill_main', [ + 'apis' => [ + [ + 'class' => ThirdParty::class, + 'controller' => ThirdPartyApiController::class, + 'name' => 'thirdparty', + 'base_path' => '/api/1.0/thirdparty/thirdparty', + 'actions' => [ + '_entity' => [ + 'methods' => [ + Request::METHOD_GET => true, + Request::METHOD_HEAD => true, + Request::METHOD_POST => true, + Request::METHOD_PUT => true, + Request::METHOD_PATCH => true, + ], + 'roles' => [ + Request::METHOD_GET => ThirdPartyVoter::SHOW, + Request::METHOD_HEAD => ThirdPartyVoter::SHOW, + Request::METHOD_POST => ThirdPartyVoter::CREATE, + Request::METHOD_PUT => ThirdPartyVoter::CREATE, + Request::METHOD_PATCH => ThirdPartyVoter::CREATE, + ], + ], + ], + ], + ], + ]); + + ``` + + diff --git a/composer.json b/composer.json index f08f94677..9ec23e857 100644 --- a/composer.json +++ b/composer.json @@ -13,14 +13,12 @@ "ext-json": "*", "ext-openssl": "*", "ext-redis": "*", - "champs-libres/async-uploader-bundle": "dev-sf4#d57134aee8e504a83c902ff0cf9f8d36ac418290", "champs-libres/wopi-bundle": "dev-master@dev", "champs-libres/wopi-lib": "dev-master@dev", "doctrine/doctrine-bundle": "^2.1", "doctrine/doctrine-migrations-bundle": "^3.0", "doctrine/orm": "^2.13.0", "erusev/parsedown": "^1.7", - "graylog2/gelf-php": "^1.5", "knplabs/knp-menu-bundle": "^3.0", "knplabs/knp-time-bundle": "^1.12", "knpuniversity/oauth2-client-bundle": "^2.10", @@ -34,27 +32,48 @@ "ramsey/uuid-doctrine": "^1.7", "sensio/framework-extra-bundle": "^5.5", "spomky-labs/base64url": "^2.0", - "symfony/browser-kit": "^4.4", + "symfony/asset": "^5.4", + "symfony/browser-kit": "^5.4", + "symfony/cache": "^5.4", "symfony/clock": "^6.2", - "symfony/css-selector": "^4.4", - "symfony/expression-language": "^4.4", - "symfony/form": "^4.4", - "symfony/framework-bundle": "^4.4", - "symfony/http-client": "^4.4 || ^5", - "symfony/http-foundation": "^4.4", - "symfony/intl": "^4.4", + "symfony/config": "^5.4", + "symfony/console": "^5.4", + "symfony/css-selector": "^5.4", + "symfony/dom-crawler": "^5.4", + "symfony/error-handler": "^5.4", + "symfony/event-dispatcher": "^5.4", + "symfony/event-dispatcher-contracts": "^2.4", + "symfony/expression-language": "^5.4", + "symfony/filesystem": "^5.4", + "symfony/finder": "^5.4", + "symfony/form": "^5.4", + "symfony/framework-bundle": "^5.4", + "symfony/http-client": "^5.4", + "symfony/http-foundation": "^5.4", + "symfony/intl": "^5.4", "symfony/mailer": "^5.4", "symfony/messenger": "^5.4", "symfony/mime": "^5.4", "symfony/monolog-bundle": "^3.5", - "symfony/security-bundle": "^4.4", - "symfony/serializer": "^5.3", - "symfony/translation": "^4.4", - "symfony/twig-bundle": "^4.4", - "symfony/validator": "^4.4", + "symfony/options-resolver": "^5.4", + "symfony/process": "^5.4", + "symfony/property-access": "^5.4", + "symfony/property-info": "^5.4", + "symfony/routing": "^5.4", + "symfony/security-bundle": "^5.4", + "symfony/security-core": "^5.4", + "symfony/security-csrf": "^5.4", + "symfony/security-guard": "^5.4", + "symfony/security-http": "^5.4", + "symfony/serializer": "^5.4", + "symfony/string": "^5.4", + "symfony/templating": "^5.4", + "symfony/translation": "^5.4", + "symfony/twig-bundle": "^5.4", + "symfony/validator": "^5.4", "symfony/webpack-encore-bundle": "^1.11", - "symfony/workflow": "^4.4", - "symfony/yaml": "^4.4", + "symfony/workflow": "^5.4", + "symfony/yaml": "^5.4", "thenetworg/oauth2-azure": "^2.0", "twig/extra-bundle": "^3.0", "twig/intl-extra": "^3.0", @@ -73,17 +92,15 @@ "phpstan/phpstan": "^1.9", "phpstan/phpstan-deprecation-rules": "^1.1", "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": ">= 7.5", - "psalm/plugin-phpunit": "^0.18.4", - "psalm/plugin-symfony": "^4.0.2", - "rector/rector": "1.1.1", - "symfony/debug-bundle": "^5.1", - "symfony/dotenv": "^4.4", + "phpunit/phpunit": "^10.5.24", + "rector/rector": "^1.1.0", + "symfony/debug-bundle": "^5.4", + "symfony/dotenv": "^5.4", "symfony/maker-bundle": "^1.20", - "symfony/phpunit-bridge": "^4.4", - "symfony/stopwatch": "^4.4", - "symfony/var-dumper": "^4.4", - "vimeo/psalm": "^4.30.0" + "symfony/phpunit-bridge": "^7.1", + "symfony/runtime": "^5.4", + "symfony/stopwatch": "^5.4", + "symfony/var-dumper": "^5.4" }, "conflict": { "symfony/symfony": "*" @@ -98,6 +115,8 @@ "Chill\\DocGeneratorBundle\\": "src/Bundle/ChillDocGeneratorBundle", "Chill\\DocStoreBundle\\": "src/Bundle/ChillDocStoreBundle", "Chill\\EventBundle\\": "src/Bundle/ChillEventBundle", + "Chill\\FranceTravailApiBundle\\": "src/Bundle/ChillFranceTravailApiBundle/src", + "Chill\\JobBundle\\": "src/Bundle/ChillJobBundle/src", "Chill\\MainBundle\\": "src/Bundle/ChillMainBundle", "Chill\\PersonBundle\\": "src/Bundle/ChillPersonBundle", "Chill\\ReportBundle\\": "src/Bundle/ChillReportBundle", @@ -132,6 +151,7 @@ "scripts": { "auto-scripts": { "cache:clear": "symfony-cmd" - } + }, + "php-cs-fixer": "php-cs-fixer fix --config=./.php-cs-fixer.dist.php --show-progress=none" } } diff --git a/docs/source/_static/code/exports/BirthdateFilter.php b/docs/source/_static/code/exports/BirthdateFilter.php index e25d8b42f..fca768ab3 100644 --- a/docs/source/_static/code/exports/BirthdateFilter.php +++ b/docs/source/_static/code/exports/BirthdateFilter.php @@ -21,7 +21,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; class BirthdateFilter implements ExportElementValidatedInterface, FilterInterface { // add specific role for this filter - public function addRole() + public function addRole(): ?string { // we do not need any new role for this filter, so we return null return null; diff --git a/docs/source/development/pagination/example.php b/docs/source/development/pagination/example.php index 964da8764..ef565e941 100644 --- a/docs/source/development/pagination/example.php +++ b/docs/source/development/pagination/example.php @@ -15,9 +15,12 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; class example extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController { + public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) + { + } public function yourAction() { - $em = $this->getDoctrine()->getManager(); + $em = $this->managerRegistry->getManager(); // first, get the number of total item are available $total = $em ->createQuery('SELECT COUNT (item.id) FROM ChillMyBundle:Item item') diff --git a/docs/source/development/useful-snippets/controller-secured-for-person.php b/docs/source/development/useful-snippets/controller-secured-for-person.php index da2078a7a..35028f524 100644 --- a/docs/source/development/useful-snippets/controller-secured-for-person.php +++ b/docs/source/development/useful-snippets/controller-secured-for-person.php @@ -18,6 +18,9 @@ use Symfony\Component\Security\Core\Role\Role; class ConsultationController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController { + public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) + { + } /** * @param int $id personId * @@ -48,7 +51,7 @@ class ConsultationController extends \Symfony\Bundle\FrameworkBundle\Controller\ ); // create a query which take circles into account - $consultations = $this->getDoctrine()->getManager() + $consultations = $this->managerRegistry->getManager() ->createQuery('SELECT c FROM ChillHealthBundle:Consultation c ' . 'WHERE c.patient = :person AND c.circle IN(:circles) ' . 'ORDER BY c.date DESC') diff --git a/docs/source/installation/index.rst b/docs/source/installation/index.rst index 67a0b6ec6..a9a4ea0c6 100644 --- a/docs/source/installation/index.rst +++ b/docs/source/installation/index.rst @@ -14,6 +14,359 @@ Installation & Usage #################### + +You will learn here how to install a new symfony project with chill, and configure it. + +Requirements +============ + +The installation is tested on a Debian-like linux distribution. The installation on other operating systems is not documented. + +You have to install the following tools on your computer: + +- `PHP `_, version 8.3+, with the following extensions: pdo_pgsql, intl, mbstring, zip, bcmath, exif, sockets, redis, ast, gd; +- `composer `_; +- `symfony cli `_; +- `node, we encourage you to use nvm to configure the correct version `_. The project contains an + :code:`.nvmrc` file which selects automatically the required version of node (if present). +- `yarn `_. We use the version 1.22+ for now. +- `docker and the plugin compose `_ to run the database + +Chill needs a redis server and a postgresql database, and a few other things like a "relatorio service" which will +generate documents from templates. **All these things are available through docker using the plugin compose**. We do not provide +information on how to run this without docker compose. + + +Install a new project +===================== + +Initialize project and dependencies +*********************************** + +.. code-block:: bash + + symfony new --version=5.4 my_chill_project + cd my_chill_project + +We strongly encourage you to initialize a git repository at this step, to track further changes. + +.. code-block:: bash + + # add the flex endpoints required for custom recipes + cat <<< "$(jq '.extra.symfony += {"endpoint": ["flex://defaults", "https://gitlab.com/api/v4/projects/57371968/repository/files/index.json/raw?ref=main"]}' composer.json)" > composer.json + # install chill and some dependencies + # TODO fix the suffix "alpha1" and replace by ^3.0.0 when version 3.0.0 will be released + symfony composer require chill-project/chill-bundles v3.0.0-RC3 champs-libres/wopi-lib dev-master@dev champs-libres/wopi-bundle dev-master@dev + +We encourage you to accept the inclusion of the "Docker configuration from recipes": this is the documented way to run the database. +You must also accept to configure recipes from the contrib repository, unless you want to configure the bundles manually). + +.. code-block:: bash + + # fix some configuration + ./post-install-chill.sh + # install node dependencies + yarn install + # and compile assets + yarn run encore production + +.. note:: + + If you encounter this error during assets compilation (:code:`yarn run encore production`) (repeated multiple times): + + .. code-block:: txt + + [tsl] ERROR in /tmp/chill/v1/public/bundles/chillcalendar/types.ts(2,65) + TS2307: Cannot find module '../../../ChillMainBundle/Resources/public/types' or its corresponding type declarations. + + run: + + .. code-block:: bash + + rm -rf public/bundles/* + + Then restart the compilation of assets (:code:```yarn run encore production```) + +Configure your project +********************** + +You should read the configuration files in :code:`chill/config/packages` carefully, especially if you have +custom developments. But most of the time, this should be fine. + +You have to configure some local variables, which are described in the :code:`.env` file. The secrets should not be stored +in this :code:`.env` file, but instead using the `secrets management tool `_ +or in the :code:`.env.local` file, which should not be committed to the git repository. + +You do not need to set variables for the smtp server, redis server and relatorio server, as they are generated automatically +by the symfony server, from the docker compose services. + +The only required variable is the :code:`ADMIN_PASSWORD`. You can generate a hashed and salted admin password using the command +:code:`symfony console security:hash-password 'Symfony\Component\Security\Core\User\User'`. Then, +you can either: + +- add this password to the :code:`.env.local` file, you must escape the character :code:`$`: if the generated password + is :code:`$2y$13$iyvJLuT4YEa6iWXyQV4/N.hNHpNG8kXlYDkkt5MkYy4FXcSwYAwmm`, your :code:`.env.local` file will be: + + .. code-block:: env + + ADMIN_PASSWORD=\$2y\$13\$iyvJLuT4YEa6iWXyQV4/N.hNHpNG8kXlYDkkt5MkYy4FXcSwYAwmm + # note: if you copy-paste the line above, the password will be "admin". + +- add the generated password to the secrets manager (**note**: you must add the generated hashed password to the secrets env, + not the password in clear text). + +- set up the jwt authentication bundle + +Some environment variables are available for the JWT authentication bundle in the :code:`.env` file. + +Prepare migrations and other tools +********************************** + +To continue the installation process, you will have to run migrations: + +.. code-block:: bash + + # start databases and other services + docker compose up -d + # the first start, it may last some seconds, you can check with docker compose ps + # run migrations + symfony console doctrine:migrations:migrate + # setup messenger + symfony console messenger:setup-transports + # prepare some views + symfony console chill:db:sync-views + # generate jwt token, required for some api features (webdav access, ...) + symfony console lexik:jwt:generate-keypair + +.. warning:: + + If you encounter an error while running :code:`symfony console messenger:setup-transports`, you can set up the messenger + transport to redis, by adding this in the :code:`.env.local` or :code:`.env` file: + + .. code-block:: env + + MESSENGER_TRANSPORT_DSN=redis://${REDIS_HOST}:${REDIS_PORT}/messages + +Start your web server locally +***************************** + +At this step, Chill will be ready to be served locally, but without any configuration. You can run the project +locally using the `local symfony server `_: + +.. code-block:: bash + + # see the whole possibilities at https://symfony.com/doc/current/setup/symfony_server.html + symfony server:start -d + + +If you need to test the instance with accounts and some basic configuration, please install the fixtures (see below). + + +Add capabilities for dev +======================== + +If you need to add custom bundles, you can develop them in the `src/` directory, like for any other symfony project. You +can rely on the whole chill framework, meaning there is no need to add them to the original `chill-bundles`. + +You will require some bundles to have the following development tools: + +- add fixtures +- add profiler and debug bundle + +Install fixtures +**************** + +.. code-block:: bash + + # generate fixtures for chill + symfony composer require --dev doctrine/doctrine-fixtures-bundle nelmio/alice + # now, you can generate fixtures (this will reset your database) + symfony console doctrine:fixtures:load + +This will generate user accounts, centers, and some basic configuration. + +The accounts created are: :code:`center a_social`, :code:`center b_social`, :code:`center a_direction`, ... The full list is +visible in the "users" table: :code:`docker compose exec database psql -U app -c "SELECT username FROM users"`. + +The password is always :code:`password`. + +.. warning:: + + The fixtures are not fully functional. See the `corresponding issue `_. + +Add web profiler and debugger +***************************** + +.. code-block:: bash + + symfony composer require --dev symfony/web-profiler-bundle symfony/debug-bundle + +Working on chill bundles +************************ + +If you plan to improve the chill-bundles repository, that's great! + +You will have to download chill-bundles as a git repository (and not as an archive, which is barely editable). + +In your :code:`composer.json` file, add these lines: + +.. code-block:: diff + + { + "config": { + + "preferred-install": { + + "chill-project/chill-bundles": "source", + "*": "dist" + + } + } + +Then, run :code:`symfony composer reinstall chill-project/chill-bundles` to re-install the package from source. + +Code style, code quality and other tools +**************************************** + +For development, you will also have to install: + +- `php-cs-fixer `_ + +We also encourage you to use tools like `phpstan `_ and `rector `_. + +Commit and share your project +============================= + +If multiple developers work on a project, you can commit your symfony project and share it with other people. + +When another developer clones your project, they will have to: + +- run :code:`symfony composer install` and :code:`yarn install` to install the same dependencies as the initial developer; +- run :code:`yarn run encore production` to compile assets; +- copy any possible variables from the :code:`.env.local` files; +- start the docker compose stack, using :code:`docker compose`, and run migrations, set up transports, and prepare chill db views + (see the corresponding command above) + +Update +====== + +In order to update your app, you must update dependencies: + +- for chill-bundles, you can `set the last version `_ manually + in the :code:`composer.json` file, or set the version to `^3.0.0` and run :code:`symfony composer update` regularly +- run :code:`composer update` and :code:`yarn update` to maintain your dependencies up-to-date. + +After each update, you must update your database schema: + +.. code-block:: bash + + symfony console doctrine:migrations:migrate + symfony console chill:db:sync-views + +Operations +========== + +Build assets +************ + +run those commands: + +.. code-block:: bash + + # for production (or in dev, when you don't need to work on your assets and need some speed) + yarn run encore production + # in dev, when you wan't to reload the assets on each changes + yarn run encore dev --watch + +How to execute the console ? +**************************** + +.. code-block:: bash + + # start the console with all required variables + symfony console + # you can add your command after that: + symfony console list + +How to generate documents +************************* + +Documents are generated asynchronously by `"consuming messages" `_. + +You must generate them using a dedicated process: + +.. code-block:: bash + + symfony console messenger:consume async priority + +To avoid memory issues, we encourage you to also use the :code:`--limit` parameter of the command. + +How to read emails sent by the program ? +******************************************* + +In development, there is a built-in "mail catcher". Open it with :code:`symfony open:local:webmail` + +How to run cron-jobs ? +********************** + +Some commands must be executed in :ref:`cron jobs `. To execute them: + +.. code-block:: bash + + symfony console chill:cron-job:execute + +What about materialized views ? +******************************* + +There are some materialized views in chill, to speed up some complex computations in the database. + +In order to refresh them, run a cron job or refresh them manually in your database. + +How to run tests for chill-bundles +********************************** + +Tests reside inside the installed bundles. You must `cd` into that directory, download the required packages, and execute them from this place. + +**Note**: some bundles require the fixtures to be executed. See the dedicated _how-tos_. + +Example, for running a unit test inside `main` bundle: + +.. code-block:: bash + + # cd into main directory + cd vendor/chill-project/chill-bundles + composer install + # run tests + bin/phpunit src/Bundle/path/to/your/test + +Or for running tests to check code style and php conventions with csfixer and phpstan: + +Troubleshooting +=============== + +Error `An exception has been thrown during the rendering of a template ("Asset manifest file "/var/www/app/web/build/manifest.json" does not exist.").` on first run +******************************************************************************************************************************************************************** + +Build assets, see above. + +Running in production +===================== + +Currently, to run this software in production, the *state of the art* is the following : + +1. Run the software locally and tweak the configuration to your needs ; +2. Build the image and store it in a private container registry. + +.. warning:: + + In production, you **must** set these variables: + + * ``APP_ENV`` to ``prod`` + * ``APP_DEBUG`` to ``false`` + + There are security issues if you keep the same variables as for production. + + +Going further +============= + .. toctree:: :maxdepth: 2 @@ -21,386 +374,3 @@ Installation & Usage load-addresses.rst prod-calendar-sms-sending.rst msgraph-configure.rst - - -Requirements -************ - -- This project use `docker `_ to be run. As a developer, use `docker-compose `_ to bootstrap a dev environment in a glance. You do not need any other dependencies ; -- Make is used to automate scripts. - -Installation -************ - -If you plan to run chill in production: - -1. install it locally first, and check if everything is ok on your local machine; -2. once ready, build the image from your local machine, and deploy them. - -If you want to develop some bundles, the first step is sufficient (until you deploy on production). - - -1. Get the code -=============== - -Clone or download the chill-skeleton project and `cd` into the main directory. - - -.. code-block:: bash - - git clone https://gitea.champs-libres.be/Chill-project/chill-skeleton-basic.git - 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. - -2. Prepare composer to download the sources -=========================================== - -As you are running in dev, you must configure an auth token for getting the source code. - -.. warning - - If you skip this part, the code will be downloaded from dist instead of source (with git repository). You will probably replace the source manually, but the next time you will run ```composer update```, your repository will be replaced and you might loose something. - -1. Create a personal access token from https://gitlab.com/-/profile/personal_access_tokens, with the `read_api` scope. -2. add a file called ```.composer/auth.json``` with this content: - - .. code-block:: json - - { - "gitlab-token": { - "gitlab.com": "glXXX-XXXXXXXXXXXXXXXXXXXX" - } - } - -2. Prepare your variables and environment -========================================= - -Copy ```docker-compose.override.dev.yml``` into ```docker-compose.override.yml``` - -.. code-block:: bash - - cp docker-compose.override.dev.template.yml docker-compose.override.yml - -2. Prepare your variables and docker-compose -============================================ - -Have a look at the variable in ``.env`` and check if you need to adapt them. If they do not adapt with your need, or if some are missing: - -1. copy the file as ``.env.local``: ``cp .env .env.local`` -2. you may replace some variables inside ``.env`` - -Prepare also you docker-compose installation, and adapt it to your needs: - -1. If you plan to deploy on dev, copy the file ``docker-compose.override.dev.template.yml`` to ``docker-compose.override.yml``. -2. adapt to your needs. - - -**Note**: If you intend to use the bundle ``Chill-Doc-Store``, you will need to configure and install an openstack object storage container with temporary url middleware. You will have to configure `secret keys `_. - -3. Run the bootstrap script -=========================== - -This script can be run using `make` - -.. code-block:: bash - - make init - -This script will : - -1. force docker-compose to, eventually, pull the base images and build the image used by this project ; -2. run an install script to download `composer `_ ; -3. install the php dependencies -4. build assets - -.. warning:: - - The script will work only if the binary ``docker-compose`` is located into your ``PATH``. If you use ``compose`` as a docker plugin, - you can simulate this binary by creating this file at (for instance), ``/usr/local/bin/docker-compose`` (and run ``chmod +x /usr/local/bin/docker-compose``): - - .. code-block:: bash - - #!/bin/bash - - /usr/bin/docker compose "$@" - - -.. note:: - - In some cases it can happen that an old image (chill_base_php82 or chill_php82) stored in the docker cache will make the script fail. To solve this problem you have to delete the image and the container, before the make init : - - .. code-block:: bash - - docker-compose images php - docker rmi -f chill_php82:prod - docker-compose rm php - - -4. Start the project -==================== - -.. code-block:: bash - - docker-compose up - -**On the first run** (and after each upgrade), you must execute *post update commands* and run database migrations. With a container up and running, execute the following commands: - -.. code-block:: bash - - # mount into to container - ./docker-php.sh - bin/console chill:db:sync-views - # and load fixtures - bin/console doctrine:migrations:migrate - - -Chill will be available at ``http://localhost:8001.`` Currently, there isn't any user or data. To add fixtures, run - -.. code-block:: bash - - # mount into to container - ./docker-php.sh - # and load fixtures (do not this for production) - bin/console doctrine:fixtures:load --purge-with-truncate - -There are several users available: - -- ``center a_social`` -- ``center b_social`` - -The password is always ``password``. - -Now, read `Operations` below. For running in production, read `prod_`. - - -Operations -********** - -Build assets -============ - -run those commands: - -.. code-block:: bash - - make build-assets - -How to execute the console ? -============================ - -.. code-block:: bash - - # if a container is running - ./docker-php.sh - # if not - docker-compose run --user $(id -u) php bin/console - -How to create the database schema (= run migrations) ? -====================================================== - -.. code-block:: bash - - # if a container is running - ./docker-php.sh - bin/console doctrine:migrations:migrate - bin/console chill:db:sync-views - # if not - docker-compose run --user $(id -u) php bin/console doctrine:migrations:migrate - docker-compose run --user $(id -u) php bin/console chill:db:sync-views - - -How to read the email sent by the program ? -=========================================== - -Go at ``http://localhost:8005`` and you should have access to mailcatcher. - -In case of you should click on a link in the email, be aware that you should remove the "s" from https. - -How to load fixtures ? (development mode only) -============================================== - -.. code-block:: bash - - # if a container is running - ./docker-php.sh - bin/console doctrine:fixtures:load - # if not - docker-compose run --user $(id -u) php bin/console doctrine:fixtures:load - -How to open a terminal in the project -===================================== - -.. code-block:: bash - - # if a container is running - ./docker-php.sh - # if not - docker-compose run --user $(id -u) php /bin/bash - -How to run cron-jobs ? -====================== - -Some command must be executed in :ref:`cron jobs `. To execute them: - -.. code-block:: bash - - # if a container is running - ./docker-php.sh - bin/console chill:cron-job:execute - # some of them are executed only during the night. So, we have to force the execution during the day: - bin/console chill:cron-job:execute 'name-of-the-cron' - # if not - docker-compose run --user $(id -u) php bin/console chill:cron-job:execute - # some of them are executed only during the night. So, we have to force the execution during the day: - docker-compose run --user $(id -u) php bin/console chill:cron-job:execute 'name-of-the-cron' - -How to run composer ? -===================== - -.. code-block:: bash - - # if a container is running - ./docker-php.sh - composer - # if not - docker-compose run --user $(id -u) php composer - -How to access to PGADMIN ? -========================== - -Pgadmin is installed with docker-compose, and is available **only if you uncomment the appropriate lines into ``docker-compose.override.yml``. - -You can access it at ``http://localhost:8002``. - -Credentials: - -- login: from the variable you set into ``docker-composer.override.yml`` -- password: same :-) - -How to run tests ? -================== - -Tests reside inside the installed bundles. You must `cd` into that directory, download the required packages, and execute them from this place. - -**Note**: some bundle require the fixture to be executed. See the dedicated _how-tos_. - -Exemple, for running unit test inside `main` bundle: - -.. code-block:: bash - - # mount into the php image - ./docker-php.sh - # cd into main directory - cd vendor/chill-project/chill-bundles - # download deps - git submodule init - git submodule update - composer install - # run tests - bin/phpunit src/Bundle/path/to/your/test - -Or for running tests to check code style and php conventions with csfixer and phpstan: - -.. code-block:: bash - - # run code style fixer - bin/grumphp run --tasks=phpcsfixer - # run phpstan - bin/grumphp run --tasks=phpstan - - -.. note:: - - To avoid phpstan block your commits: - - .. code-block:: bash - - git commit -n ... - - To avoid phpstan block your commits permanently: - - .. code-block:: bash - - ./bin/grumphp git:deinit - -How to run webpack interactively -================================ - -Executing :code:`bash docker-node.sh` will open a terminal in a node container, with volumes mounted. - -How to switch the branch for chill-bundles, and get new dependencies -==================================================================== - -During development, you will switch to new branches for chill-bundles. As long as the dependencies are equals, this does not cause any problem. But sometimes, a new branch introduces a new dependency, and you must download it. - -.. warning:: - - Ensure that you have gitlab-token ready before updating your branches. See above. - -In order to do that without pain, use those steps: - -0. Ensuire you have a token, set -1. at the app's root, update the ``composer.json`` to your current branch: - -.. code-block:: json - - { - "require": { - "chill-bundles": "dev-@dev" - } - -2. mount into the php container (``./docker-php.sh``), and run ``composer update`` - -Error `An exception has been thrown during the rendering of a template ("Asset manifest file "/var/www/app/web/build/manifest.json" does not exist.").` on first run -==================================================================================================================================================================== - -Run :code:`make build-assets` - -Running in production -********************* - -Currently, to run this software in production, the *state of the art* is the following : - -1. Run the software locally and tweak the configuration to your needs ; -2. Build the image and store them into a private container registry. This can be done using :code:`make build-and-push-image`. - - To be sure to target the correct container registry, you have to adapt the image names into your ``docker-compose.override.yml`` file. -3. Push the image on your registry, or upload them to the destination machine using ``docker image save`` and ``docker image load``. -3. Run the image on your production server, using docker-compose or eventually docker stack. You have to customize the variable set in docker-compose. - - See also the :ref:`running-production-tips-and-tricks` below. - -.. warning:: - - In production, you **must** set those variables: - - * ``APP_ENV`` to ``prod`` - * ``APP_DEBUG`` to ``false`` - - There are security issues if you keep the same variable than for production. - - -.. _running-production-tips-and-tricks: - -Tips and tricks -=============== - -Operation on database (backups, running custom sql, replication) are easier to set when run outside of a container. If you run into a container, take care of the volume where data are stored. - -The PHP sessions are stored inside redis. This is useful if you distribute the traffic amongst different php server: they will share same sessions if a request goes into a different instance of the container. - -When the PHP servers are shared across multiple instances, take care that some data is stored into redis: the same redis server should be reachable by all instances. - -It is worth having an eye on the configuration of logstash container. - - -Design principles -***************** - -Why the DB URL is also set in environment, and not in .env file ? -================================================================= - -Because, at startup, a script does check the db is up and, if not, wait for a couple of seconds before running ``entrypoint.sh``. For avoiding double configuration, the configuration of the PHP app takes his configuration from environment also (and it will be standard in future releases, with symfony 4.0). - diff --git a/package.json b/package.json index 17c7064a7..0c932b9f6 100644 --- a/package.json +++ b/package.json @@ -6,29 +6,33 @@ "@apidevtools/swagger-cli": "^4.0.4", "@babel/core": "^7.20.5", "@babel/preset-env": "^7.20.2", - "@ckeditor/ckeditor5-build-classic": "^35.3.2", - "@ckeditor/ckeditor5-dev-utils": "^31.1.13", + "@ckeditor/ckeditor5-build-classic": "^41.4.2", + "@ckeditor/ckeditor5-dev-utils": "^40.2.0", "@ckeditor/ckeditor5-dev-webpack-plugin": "^31.1.13", - "@ckeditor/ckeditor5-markdown-gfm": "^35.3.2", - "@ckeditor/ckeditor5-theme-lark": "^35.3.2", - "@ckeditor/ckeditor5-vue": "^4.0.1", + "@ckeditor/ckeditor5-dev-translations": "^40.2.0", + "@ckeditor/ckeditor5-markdown-gfm": "^41.4.2", + "@ckeditor/ckeditor5-theme-lark": "^41.4.2", + "@ckeditor/ckeditor5-vue": "^5.1.0", "@symfony/webpack-encore": "^4.1.0", "@tsconfig/node14": "^1.0.1", + "@types/dompurify": "^3.0.5", "bindings": "^1.5.0", "bootstrap": "5.2.3", "chokidar": "^3.5.1", + "dompurify": "^3.1.0", "fork-awesome": "^1.1.7", "jquery": "^3.6.0", "node-sass": "^8.0.0", + "marked": "^12.0.1", "popper.js": "^1.16.1", "postcss-loader": "^7.0.2", "raw-loader": "^4.0.2", - "sass-loader": "^13.0.0", + "sass-loader": "^14.0.0", "select2": "^4.0.13", "select2-bootstrap-theme": "0.1.0-beta.10", "style-loader": "^3.3.1", "ts-loader": "^9.3.1", - "typescript": "^4.7.2", + "typescript": "^5.4.5", "vue-loader": "^17.0.0", "webpack": "^5.75.0", "webpack-cli": "^5.0.1" @@ -54,7 +58,7 @@ "vue": "^3.2.37", "vue-i18n": "^9.1.6", "vue-multiselect": "3.0.0-alpha.2", - "vue-toast-notification": "^2.0", + "vue-toast-notification": "^3.1.2", "vuex": "^4.0.0" }, "browserslist": [ diff --git a/phpstan-baseline-2024-05.neon b/phpstan-baseline-2024-05.neon index 728ec4edc..12cb03856 100644 --- a/phpstan-baseline-2024-05.neon +++ b/phpstan-baseline-2024-05.neon @@ -4,3 +4,11 @@ parameters: message: "#^Parameter \\#1 \\$records of method League\\\\Csv\\\\Writer\\:\\:insertAll\\(\\) expects iterable\\\\>, iterable\\\\> given\\.$#" count: 1 path: src/Bundle/ChillMainBundle/Controller/UserExportController.php + + - + message: """ + #^Fetching deprecated class constant ASC of class Doctrine\\\\Common\\\\Collections\\\\Criteria\\: + use Order\\:\\:Ascending instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php diff --git a/phpstan-baseline-deprecations-doctrine-orm.neon b/phpstan-baseline-deprecations-doctrine-orm.neon new file mode 100644 index 000000000..824c0371f --- /dev/null +++ b/phpstan-baseline-deprecations-doctrine-orm.neon @@ -0,0 +1,58 @@ +# See https://github.com/doctrine/orm/issues/11313 for a follow-up +parameters: + ignoreErrors: + - + message: """ + #^Fetching deprecated class constant ASC of class Doctrine\\\\Common\\\\Collections\\\\Criteria\\: + use Order\\:\\:Ascending instead$# + """ + count: 1 + path: src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php + + - + message: """ + #^Fetching deprecated class constant ASC of class Doctrine\\\\Common\\\\Collections\\\\Criteria\\: + use Order\\:\\:Ascending instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Entity/Notification.php + + - + message: """ + #^Fetching deprecated class constant DESC of class Doctrine\\\\Common\\\\Collections\\\\Criteria\\: + use Order\\:\\:Descending instead$# + """ + count: 1 + path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php + + - + message: """ + #^Fetching deprecated class constant DESC of class Doctrine\\\\Common\\\\Collections\\\\Criteria\\: + use Order\\:\\:Descending instead$# + """ + count: 1 + path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php + + - + message: """ + #^Fetching deprecated class constant DESC of class Doctrine\\\\Common\\\\Collections\\\\Criteria\\: + use Order\\:\\:Descending instead$# + """ + count: 2 + path: src/Bundle/ChillPersonBundle/Entity/Household/Household.php + + - + message: """ + #^Fetching deprecated class constant DESC of class Doctrine\\\\Common\\\\Collections\\\\Criteria\\: + use Order\\:\\:Descending instead$# + """ + count: 2 + path: src/Bundle/ChillPersonBundle/Entity/Person.php + + - + message: """ + #^Fetching deprecated class constant DESC of class Doctrine\\\\Common\\\\Collections\\\\Criteria\\: + use Order\\:\\:Descending instead$# + """ + count: 1 + path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php diff --git a/phpstan-baseline-level-5.neon b/phpstan-baseline-level-5.neon index 23321ba68..34e2825a3 100644 --- a/phpstan-baseline-level-5.neon +++ b/phpstan-baseline-level-5.neon @@ -100,11 +100,6 @@ parameters: count: 1 path: src/Bundle/ChillEventBundle/Controller/EventController.php - - - message: "#^Parameter \\#1 \\$name of method Symfony\\\\Component\\\\Form\\\\FormFactoryInterface\\:\\:createNamedBuilder\\(\\) expects string, null given\\.$#" - count: 1 - path: src/Bundle/ChillEventBundle/Controller/EventController.php - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, Chill\\\\MainBundle\\\\Entity\\\\Center given\\.$#" count: 1 @@ -165,11 +160,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Controller/ExportController.php - - - message: "#^Parameter \\#1 \\$name of method Symfony\\\\Component\\\\Form\\\\FormFactoryInterface\\:\\:createNamedBuilder\\(\\) expects string, null given\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Controller/ExportController.php - - message: "#^Parameter \\#3 \\$alias of method Chill\\\\MainBundle\\\\Controller\\\\ExportController\\:\\:exportFormStep\\(\\) expects string, Symfony\\\\Component\\\\HttpFoundation\\\\Request given\\.$#" count: 1 diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a89386f29..641bb5dcd 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -5,6 +5,26 @@ parameters: count: 1 path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php + - + message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" + count: 1 + path: src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php + + - + message: "#^Property Chill\\\\CustomFieldsBundle\\\\Entity\\\\CustomField\\:\\:\\$required \\(false\\) does not accept bool\\.$#" + count: 1 + path: src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php + + - + message: "#^Parameter \\#1 \\$user of method Chill\\\\DocStoreBundle\\\\Entity\\\\Document\\:\\:setUser\\(\\) expects Chill\\\\MainBundle\\\\Entity\\\\User\\|null, Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null given\\.$#" + count: 2 + path: src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php + + - + message: "#^Parameter \\#1 \\$user of method Chill\\\\DocStoreBundle\\\\Entity\\\\Document\\:\\:setUser\\(\\) expects Chill\\\\MainBundle\\\\Entity\\\\User\\|null, Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null given\\.$#" + count: 2 + path: src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php + - message: "#^Variable \\$participation might not be defined\\.$#" count: 3 @@ -15,6 +35,106 @@ parameters: count: 1 path: src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php + - + message: "#^Comparison operation \"\\>\" between \\(bool\\|int\\|Redis\\) and 0 results in an error\\.$#" + count: 1 + path: src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/ApiWrapper.php + + - + message: "#^Variable \\$response might not be defined\\.$#" + count: 1 + path: src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/ApiWrapper.php + + - + message: "#^Function GuzzleHttp\\\\Psr7\\\\get not found\\.$#" + count: 1 + path: src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/PartenaireRomeAppellation.php + + - + message: "#^Function GuzzleHttp\\\\Psr7\\\\str not found\\.$#" + count: 2 + path: src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/PartenaireRomeAppellation.php + + - + message: "#^Parameter \\#1 \\$seconds of function sleep expects int, string given\\.$#" + count: 1 + path: src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/PartenaireRomeAppellation.php + + - + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 1 + path: src/Bundle/ChillJobBundle/src/Controller/CSPersonController.php + + - + message: "#^Parameter \\#1 \\$interval of method DateTimeImmutable\\:\\:add\\(\\) expects DateInterval, string\\|null given\\.$#" + count: 1 + path: src/Bundle/ChillJobBundle/src/Entity/Immersion.php + + - + message: "#^Parameter \\#1 \\$object of static method DateTimeImmutable\\:\\:createFromMutable\\(\\) expects DateTime, DateTimeInterface given\\.$#" + count: 1 + path: src/Bundle/ChillJobBundle/src/Entity/Immersion.php + + - + message: "#^Property Chill\\\\JobBundle\\\\Entity\\\\Rome\\\\Metier\\:\\:\\$appellations is never read, only written\\.$#" + count: 1 + path: src/Bundle/ChillJobBundle/src/Entity/Rome/Metier.php + + - + message: "#^Method Chill\\\\JobBundle\\\\Export\\\\ListCSPerson\\:\\:splitArrayToColumns\\(\\) never returns Closure so it can be removed from the return type\\.$#" + count: 1 + path: src/Bundle/ChillJobBundle/src/Export/ListCSPerson.php + + - + message: "#^Variable \\$f might not be defined\\.$#" + count: 1 + path: src/Bundle/ChillJobBundle/src/Export/ListCSPerson.php + + - + message: "#^Method Chill\\\\JobBundle\\\\Export\\\\ListFrein\\:\\:splitArrayToColumns\\(\\) never returns Closure so it can be removed from the return type\\.$#" + count: 1 + path: src/Bundle/ChillJobBundle/src/Export/ListFrein.php + + - + message: "#^Method Chill\\\\JobBundle\\\\Export\\\\ListProjetProfessionnel\\:\\:splitArrayToColumns\\(\\) never returns Closure so it can be removed from the return type\\.$#" + count: 1 + path: src/Bundle/ChillJobBundle/src/Export/ListProjetProfessionnel.php + + - + message: "#^Property Chill\\\\JobBundle\\\\Form\\\\ChoiceLoader\\\\RomeAppellationChoiceLoader\\:\\:\\$appellationRepository \\(Chill\\\\JobBundle\\\\Repository\\\\Rome\\\\AppellationRepository\\) does not accept Doctrine\\\\ORM\\\\EntityRepository\\\\.$#" + count: 1 + path: src/Bundle/ChillJobBundle/src/Form/ChoiceLoader/RomeAppellationChoiceLoader.php + + - + message: "#^Result of && is always false\\.$#" + count: 1 + path: src/Bundle/ChillJobBundle/src/Form/ChoiceLoader/RomeAppellationChoiceLoader.php + + - + message: "#^Strict comparison using \\=\\=\\= between array\\{\\} and Symfony\\\\Component\\\\Validator\\\\ConstraintViolationListInterface will always evaluate to false\\.$#" + count: 2 + path: src/Bundle/ChillJobBundle/src/Form/ChoiceLoader/RomeAppellationChoiceLoader.php + + - + message: "#^Strict comparison using \\=\\=\\= between null and string will always evaluate to false\\.$#" + count: 1 + path: src/Bundle/ChillJobBundle/src/Form/ChoiceLoader/RomeAppellationChoiceLoader.php + + - + message: "#^Variable \\$metier might not be defined\\.$#" + count: 1 + path: src/Bundle/ChillJobBundle/src/Form/ChoiceLoader/RomeAppellationChoiceLoader.php + + - + message: "#^Parameter \\#1 \\$interval of method DateTimeImmutable\\:\\:add\\(\\) expects DateInterval, string\\|null given\\.$#" + count: 1 + path: src/Bundle/ChillJobBundle/src/Security/Authorization/CSConnectesVoter.php + + - + message: "#^Parameter \\#1 \\$object of static method DateTimeImmutable\\:\\:createFromMutable\\(\\) expects DateTime, DateTimeInterface given\\.$#" + count: 1 + path: src/Bundle/ChillJobBundle/src/Security/Authorization/CSConnectesVoter.php + - message: "#^Cannot unset offset '_token' on array\\{formatter\\: mixed, export\\: mixed, centers\\: mixed, alias\\: string\\}\\.$#" count: 1 @@ -40,11 +160,31 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Form/ChoiceLoader/PostalCodeChoiceLoader.php + - + message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" + count: 2 + path: src/Bundle/ChillMainBundle/Repository/NotificationRepository.php + + - + message: "#^Parameter \\#1 \\$user of method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:\\:userHasAccessForCenter\\(\\) expects Chill\\\\MainBundle\\\\Entity\\\\User, Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface given\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php + + - + message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" + count: 1 + path: src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php + - message: "#^Foreach overwrites \\$value with its value variable\\.$#" count: 1 path: src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php + - + message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" + count: 1 + path: src/Bundle/ChillPersonBundle/Form/PersonType.php + - message: "#^Foreach overwrites \\$value with its value variable\\.$#" count: 1 diff --git a/phpstan-deprecations-sf54.neon b/phpstan-deprecations-sf54.neon new file mode 100644 index 000000000..e2e5e85a6 --- /dev/null +++ b/phpstan-deprecations-sf54.neon @@ -0,0 +1,153 @@ +parameters: + ignoreErrors: + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 2 + path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 3 + path: src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php + + - + message: """ + #^Call to deprecated method getUsername\\(\\) of class Chill\\\\MainBundle\\\\Entity\\\\User\\: + since Symfony 5\\.3, use getUserIdentifier\\(\\) instead$# + """ + count: 2 + path: src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php + + - + message: """ + #^Call to deprecated method getUsername\\(\\) of class Chill\\\\MainBundle\\\\Entity\\\\User\\: + since Symfony 5\\.3, use getUserIdentifier\\(\\) instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php + + - + message: """ + #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Encoder\\\\EncoderFactory\\: + since Symfony 5\\.3, use \\{@link PasswordHasherFactory\\} instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Controller/MenuController.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Controller/SearchController.php + + - + message: """ + #^Call to deprecated method getUsername\\(\\) of class Chill\\\\MainBundle\\\\Entity\\\\User\\: + since Symfony 5\\.3, use getUserIdentifier\\(\\) instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Controller/UserController.php + + - + message: """ + #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Encoder\\\\EncoderFactory\\: + since Symfony 5\\.3, use \\{@link PasswordHasherFactory\\} instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php + + - + message: """ + #^Call to deprecated method getUsername\\(\\) of class Chill\\\\MainBundle\\\\Entity\\\\User\\: + since Symfony 5\\.3, use getUserIdentifier\\(\\) instead$# + """ + count: 2 + path: src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php + + - + message: """ + #^Call to deprecated method getUsername\\(\\) of class Chill\\\\MainBundle\\\\Entity\\\\User\\: + since Symfony 5\\.3, use getUserIdentifier\\(\\) instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php + + - + message: """ + #^Call to deprecated method getUsername\\(\\) of class Chill\\\\MainBundle\\\\Entity\\\\User\\: + since Symfony 5\\.3, use getUserIdentifier\\(\\) instead$# + """ + count: 3 + path: src/Bundle/ChillMainBundle/Validation/Validator/UserUniqueEmailAndUsername.php + + - + message: """ + #^Call to deprecated method getUsername\\(\\) of class Chill\\\\MainBundle\\\\Entity\\\\User\\: + since Symfony 5\\.3, use getUserIdentifier\\(\\) instead$# + """ + count: 1 + path: src/Bundle/ChillMainBundle/Validator/Constraints/Entity/UserCircleConsistencyValidator.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 13 + path: src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 4 + path: src/Bundle/ChillPersonBundle/Controller/PersonController.php + + - + message: """ + #^Call to deprecated method get\\(\\) of class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\: + since Symfony 5\\.4, use method or constructor injection in your controller instead$# + """ + count: 7 + path: src/Bundle/ChillReportBundle/Controller/ReportController.php + + - + message: """ + #^Call to deprecated method getUsername\\(\\) of class Chill\\\\MainBundle\\\\Entity\\\\User\\: + since Symfony 5\\.3, use getUserIdentifier\\(\\) instead$# + """ + count: 1 + path: src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php diff --git a/phpstan-deprecations.neon b/phpstan-deprecations.neon index c83feeb59..7f47e9c71 100644 --- a/phpstan-deprecations.neon +++ b/phpstan-deprecations.neon @@ -1,36 +1,5 @@ parameters: ignoreErrors: - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 2 - path: src/Bundle/ChillActivityBundle/Controller/ActivityController.php - - - - message: "#^Call to deprecated method setType\\(\\) of class Chill\\\\ActivityBundle\\\\Entity\\\\Activity\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php - - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Entity/ActivityReason.php - - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php - - - - message: """ - #^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillActivityBundle/Form/ActivityType.php - - message: """ @@ -40,201 +9,10 @@ parameters: count: 1 path: src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php - - - - message: """ - #^Parameter \\$templating of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldChoice\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bridge\\\\Twig\\\\TwigEngine\\: - since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$# - """ - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php - - - - message: "#^Used function LogicException not found\\.$#" - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php - - - - message: """ - #^Parameter \\$templating of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldDate\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bundle\\\\TwigBundle\\\\TwigEngine\\: - since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$# - """ - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php - - - - message: """ - #^Parameter \\$twigEngine of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldLongChoice\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bridge\\\\Twig\\\\TwigEngine\\: - since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$# - """ - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php - - - - message: """ - #^Parameter \\$templating of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldNumber\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bundle\\\\TwigBundle\\\\TwigEngine\\: - since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$# - """ - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php - - - - message: """ - #^Parameter \\$templating of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldText\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bundle\\\\TwigBundle\\\\TwigEngine\\: - since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$# - """ - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php - - - - message: """ - #^Parameter \\$templating of method Chill\\\\CustomFieldsBundle\\\\CustomFields\\\\CustomFieldTitle\\:\\:__construct\\(\\) has typehint with deprecated class Symfony\\\\Bundle\\\\TwigBundle\\\\TwigEngine\\: - since version 4\\.3, to be removed in 5\\.0; use Twig instead\\.$# - """ - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" count: 1 - path: src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php - - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 6 - path: src/Bundle/ChillEventBundle/Controller/EventController.php - - - - message: """ - #^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillEventBundle/Form/EventType.php - - - - message: """ - #^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillEventBundle/Form/Type/PickEventType.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php - - - - message: """ - #^Parameter \\$role of method Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\CRUDController\\:\\:getReachableCenters\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php - - - - message: """ - #^Call to deprecated method getLanguageBundle\\(\\) of class Symfony\\\\Component\\\\Intl\\\\Intl\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use \\{@see Languages\\} or \\{@see Scripts\\} instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php - - - - message: """ - #^Call to deprecated method getRegionBundle\\(\\) of class Symfony\\\\Component\\\\Intl\\\\Intl\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use \\{@see Countries\\} instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php - - - - message: """ - #^Parameter \\$role of anonymous function has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php - - - - message: """ - #^Call to deprecated method getLanguageBundle\\(\\) of class Symfony\\\\Component\\\\Intl\\\\Intl\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use \\{@see Languages\\} or \\{@see Scripts\\} instead\\.$# - """ - count: 2 - path: src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php - - - - message: """ - #^Return type of method Chill\\\\MainBundle\\\\Entity\\\\User\\:\\:getRoles\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Entity/User.php - - - - message: """ - #^Class Chill\\\\MainBundle\\\\Form\\\\Event\\\\CustomizeFormEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php - - - - message: """ - #^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php - - - - message: """ - #^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php - - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 2 - path: src/Bundle/ChillMainBundle/Repository/NotificationRepository.php - - - - message: """ - #^Parameter \\$attribute of method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:\\:userHasAccess\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php + path: src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php - message: """ @@ -244,14 +22,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php - - - message: """ - #^Parameter \\$role of method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\AuthorizationHelper\\:\\:getReachableCircles\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php - - message: """ #^Parameter \\$centerResolverDispatcher of method Chill\\\\MainBundle\\\\Security\\\\Authorization\\\\DefaultVoterHelper\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\: @@ -276,14 +46,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Security/Authorization/DefaultVoterHelperGenerator.php - - - message: """ - #^Class Chill\\\\MainBundle\\\\Security\\\\PasswordRecover\\\\PasswordRecoverEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php - - message: """ #^Class Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcher implements deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\: @@ -292,35 +54,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverDispatcher.php - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php - - - - message: """ - #^Class Chill\\\\MainBundle\\\\Templating\\\\Events\\\\DelegatedBlockRenderingEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillMainBundle/Templating/Events/DelegatedBlockRenderingEvent.php - - - - message: """ - #^Class Chill\\\\PersonBundle\\\\Actions\\\\ActionEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Actions/ActionEvent.php - - - - message: """ - #^Class Chill\\\\PersonBundle\\\\Controller\\\\AccompanyingCourseController extends deprecated class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\Controller\\: - since Symfony 4\\.2, use "Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController" instead\\.$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php - - message: """ #^Call to deprecated method getCurrentAccompanyingPeriod\\(\\) of class Chill\\\\PersonBundle\\\\Entity\\\\Person\\: @@ -329,56 +62,10 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php - - - message: """ - #^Class Chill\\\\PersonBundle\\\\Controller\\\\PersonDuplicateController extends deprecated class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\Controller\\: - since Symfony 4\\.2, use "Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController" instead\\.$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php - - message: "#^Access to deprecated property \\$proxyAccompanyingPeriodOpenState of class Chill\\\\PersonBundle\\\\Entity\\\\Person\\.$#" count: 2 path: src/Bundle/ChillPersonBundle/Entity/Person.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php - - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Form/PersonType.php - - - - message: """ - #^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Form/Type/PickPersonType.php - - - - message: """ - #^Class Chill\\\\PersonBundle\\\\Privacy\\\\AccompanyingPeriodPrivacyEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php - - - - message: """ - #^Class Chill\\\\PersonBundle\\\\Privacy\\\\PrivacyEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php - - message: """ #^Parameter \\$centerResolverDispatcher of method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriodACLAwareRepository\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\: @@ -387,48 +74,6 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Widget/PersonListWidget.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 3 - path: src/Bundle/ChillReportBundle/Controller/ReportController.php - - - - - message: """ - #^Parameter \\$role of method Chill\\\\ReportBundle\\\\Form\\\\ReportType\\:\\:appendScopeChoices\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillReportBundle/Form/ReportType.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillReportBundle/Search/ReportSearch.php - - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 2 - path: src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php - - message: """ #^Parameter \\$centerResolverDispatcher of method Chill\\\\TaskBundle\\\\Controller\\\\SingleTaskController\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\: @@ -437,46 +82,6 @@ parameters: count: 1 path: src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php - - - message: """ - #^Parameter \\$role of method Chill\\\\TaskBundle\\\\Controller\\\\SingleTaskController\\:\\:setCreateForm\\(\\) has typehint with deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php - - - - message: """ - #^Class Chill\\\\TaskBundle\\\\Event\\\\TaskEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillTaskBundle/Event/TaskEvent.php - - - - message: """ - #^Class Chill\\\\TaskBundle\\\\Event\\\\UI\\\\UIEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillTaskBundle/Event/UI/UIEvent.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 4 - path: src/Bundle/ChillTaskBundle/Form/SingleTaskListType.php - - - - message: """ - #^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillTaskBundle/Form/SingleTaskType.php - - message: """ #^Parameter \\$centerResolverDispatcher of method Chill\\\\TaskBundle\\\\Form\\\\SingleTaskType\\:\\:__construct\\(\\) has typehint with deprecated interface Chill\\\\MainBundle\\\\Security\\\\Resolver\\\\CenterResolverDispatcherInterface\\: @@ -484,28 +89,3 @@ parameters: """ count: 1 path: src/Bundle/ChillTaskBundle/Form/SingleTaskType.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php - - - - message: """ - #^Class Chill\\\\TaskBundle\\\\Security\\\\Authorization\\\\AuthorizationEvent extends deprecated class Symfony\\\\Component\\\\EventDispatcher\\\\Event\\: - since Symfony 4\\.3, use "Symfony\\\\Contracts\\\\EventDispatcher\\\\Event" instead$# - """ - count: 1 - path: src/Bundle/ChillTaskBundle/Security/Authorization/AuthorizationEvent.php - - - - message: """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 3 - path: src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php - diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 4e6745469..ec4045858 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -31,5 +31,7 @@ includes: - phpstan-baseline-level-3.neon - phpstan-baseline-level-4.neon - phpstan-baseline-level-5.neon + - phpstan-deprecations-sf54.neon + - phpstan-baseline-deprecations-doctrine-orm.neon - phpstan-baseline-2024-05.neon diff --git a/phpunit.rector.xml b/phpunit.rector.xml index f8d9d3a11..25e0d25aa 100644 --- a/phpunit.rector.xml +++ b/phpunit.rector.xml @@ -1,29 +1,13 @@ - - - - utils/rector/tests - - - - - - utils/rector/src - - + + + + utils/rector/tests + + + + + utils/rector/src + + diff --git a/phpunit.xml.dist b/phpunit.xml.dist index aa519e376..336877a0c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,85 +1,73 @@ - - - - - - - - - - - - - - src/Bundle/ChillAsideActivityBundle/src/Tests/ - - - src/Bundle/ChillBudgetBundle/Tests/ - - - src/Bundle/ChillCalendarBundle/Tests/ - - - - src/Bundle/ChillDocGeneratorBundle/tests/ - - - src/Bundle/ChillDocStoreBundle/Tests/ - - + + src/Bundle/ChillDocGeneratorBundle/tests/ + + + src/Bundle/ChillDocStoreBundle/Tests/ + + - - src/Bundle/ChillMainBundle/Tests/ - - - src/Bundle/ChillPersonBundle/Tests/ - - src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingPeriodControllerTest.php - - src/Bundle/ChillPersonBundle/Tests/Controller/PersonAddressControllerTest.php - - src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php - - src/Bundle/ChillPersonBundle/Tests/Controller/PersonDuplicateControllerViewTest.php - - + src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingPeriodControllerTest.php + + src/Bundle/ChillPersonBundle/Tests/Controller/PersonAddressControllerTest.php + + src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php + + src/Bundle/ChillPersonBundle/Tests/Controller/PersonDuplicateControllerViewTest.php + + - - - src/Bundle/ChillThirdPartyBundle/Tests - - - src/Bundle/ChillWopiBundle/tests/ - - - - - - - - - + +

Projets professionnels

+ + {% if projet_professionnels|length == 0 %} +

{{ null|chill_print_or_message("Aucun rapport enregistré") }}

+ {% else %} + + + + + + + + + + + {% for pr in projet_professionnels %} + + + + + + + + {% endfor %} + +
Date de créationProjet validé ou souhaitéType de contrat 
{{ pr.reportDate|format_date('short') }} + {% set romes = [] %} + {% if pr.valide|length > 0 %} +

Projet validé :

+ {% set romes = pr.valide %} + {% elseif pr.souhait|length > 0 %} +

Projet souhaité :

+ {% set romes = pr.souhait %} + {% else %} +

Aucun souhait rempli

+ {% endif %} + +
    + {% for a in romes %} +
  • {{ a.libelle }} ({{ a.metier.code }} - {{ a.metier.libelle }})
  • + {% endfor %} +
+
+
    + {% for type in pr.typeContrat %} +
  • {{ ('projet_prof.type_contrat.' ~ type)|trans }}
  • + {% endfor %} +
+
+
    +
  • + +
  • +
  • + +
  • + {% if is_granted('CHILL_JOB_REPORT_DELETE', pr) %} +
  • + +
  • + {% endif %} +
+
+ {% endif %} + + + {% endif %} + + +{% endblock %} diff --git a/src/Bundle/ChillJobBundle/src/Security/Authorization/ExportsJobVoter.php b/src/Bundle/ChillJobBundle/src/Security/Authorization/ExportsJobVoter.php new file mode 100644 index 000000000..af4935893 --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/Security/Authorization/ExportsJobVoter.php @@ -0,0 +1,122 @@ +authorizationHelper = $authorizationHelper; + } + + /** + * @return bool + */ + protected function supports($attribute, $subject) + { + if ($subject instanceof Center) { + return self::EXPORT === $attribute; + } + if (null === $subject) { + return self::EXPORT === $attribute; + } + + return false; + } + + /** + * @return bool + */ + protected function voteOnAttribute($attribute, $subject, TokenInterface $token) + { + $user = $token->getUser(); + + if (!$user instanceof User) { + return false; + } + + $centers = $this->authorizationHelper->getReachableCenters($user, $attribute); + + if (null === $subject) { + return count($centers) > 0; + } + + return $this->authorizationHelper->userHasAccess($user, $subject, $attribute); + } + + /** + * Return an array of roles, where keys are the hierarchy, and values + * an array of roles. + * + * Example: + * + * ``` + * [ 'Title' => [ 'CHILL_FOO_SEE', 'CHILL_FOO_UPDATE' ] ] + * ``` + */ + public function getRolesWithHierarchy(): array + { + return ['JobBundle' => $this->getRoles()]; + } + + /** + * return an array of role provided by the object. + * + * @return string[] array of roles (as string) + */ + public function getRoles(): array + { + return $this->getAttributes(); + } + + /** + * return roles which doesn't need. + * + * @return string[] array of roles without scopes + */ + public function getRolesWithoutScope(): array + { + return $this->getAttributes(); + } + + /** + * @return array + */ + private function getAttributes() + { + return [self::EXPORT]; + } +} diff --git a/src/Bundle/ChillJobBundle/src/Security/Authorization/JobVoter.php b/src/Bundle/ChillJobBundle/src/Security/Authorization/JobVoter.php new file mode 100644 index 000000000..54de180f5 --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/Security/Authorization/JobVoter.php @@ -0,0 +1,119 @@ +date15DaysAgo = new \DateTime('-15 days'); + $this->authorizationHelper = $authorizationHelper; + } + + protected function supports($attribute, $subject) + { + if (!\in_array($attribute, self::ALL, true)) { + return false; + } + + if ($subject instanceof Frein + || $subject instanceof CV + || $subject instanceof Immersion + || $subject instanceof ProjetProfessionnel + || $subject instanceof Person) { + return true; + } + + return false; + } + + protected function voteOnAttribute($attribute, $subject, TokenInterface $token) + { + if ($subject instanceof Person) { + $center = $subject->getCenter(); + } else { + $center = $subject->getPerson()->getCenter(); + } + + switch ($attribute) { + case self::REPORT_NEW: + return $this->authorizationHelper->userHasAccess($token->getUser(), $center, $attribute); + + case self::REPORT_CV: + if (! ($subject instanceof CV || $subject instanceof Person)) { + return false; + } + + return $this->authorizationHelper->userHasAccess($token->getUser(), $center, $attribute); + + case self::REPORT_DELETE: + if ($subject instanceof Immersion) { + $date = \DateTimeImmutable::createFromMutable($subject->getDebutDate())->add($subject->getDuration()); + } else { + $date = $subject->getReportDate(); + } + + if (!$this->authorizationHelper->userHasAccess($token->getUser(), $center, $attribute)) { + return false; + } + + return $this->date15DaysAgo < $date; + } + + return true; + } + + public function getRoles(): array + { + return self::ALL; + } + + public function getRolesWithHierarchy(): array + { + return ['JobBundle' => $this->getRoles()]; + } + + public function getRolesWithoutScope(): array + { + return $this->getRoles(); + } +} diff --git a/src/Bundle/ChillJobBundle/src/Tests/Controller/CSPersonControllerTest.php b/src/Bundle/ChillJobBundle/src/Tests/Controller/CSPersonControllerTest.php new file mode 100644 index 000000000..a6b19e648 --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/Tests/Controller/CSPersonControllerTest.php @@ -0,0 +1,21 @@ +addSql('CREATE SCHEMA chill_job'); + $this->addSql('CREATE SEQUENCE chill_job.cv_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE chill_job.cv_experience_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE chill_job.cv_formation_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE chill_job.frein_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE chill_job.immersion_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE chill_job.projet_professionnel_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE chill_job.rome_appellation_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE chill_job.rome_metier_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE TABLE chill_job.cs_person (id INT NOT NULL, person_id INT DEFAULT NULL, prescripteur_id INT DEFAULT NULL, situationLogement VARCHAR(255) DEFAULT NULL, situationLogementPrecision TEXT DEFAULT NULL, enfantACharge INT DEFAULT NULL, niveauMaitriseLangue JSONB DEFAULT NULL, vehiculePersonnel BOOLEAN DEFAULT NULL, permisConduire JSONB DEFAULT NULL, situationProfessionnelle VARCHAR(255) DEFAULT NULL, dateFinDernierEmploi DATE DEFAULT NULL, typeContrat JSONB DEFAULT NULL, typeContratAide TEXT DEFAULT NULL, ressources JSONB DEFAULT NULL, ressourcesComment TEXT DEFAULT NULL, ressourceDate1Versement DATE DEFAULT NULL, CPFMontant NUMERIC(10, 2) DEFAULT NULL, acomptedif NUMERIC(10, 2) DEFAULT NULL, accompagnement JSONB DEFAULT NULL, accompagnementRQTHDate DATE DEFAULT NULL, accompagnementComment VARCHAR(255) DEFAULT NULL, poleEmploiId VARCHAR(255) DEFAULT NULL, poleEmploiInscriptionDate DATE DEFAULT NULL, cafId VARCHAR(255) DEFAULT NULL, cafInscriptionDate DATE DEFAULT NULL, CERInscriptionDate DATE DEFAULT NULL, PPAEInscriptionDate DATE DEFAULT NULL, CERSignataire TEXT DEFAULT NULL, PPAESignataire TEXT DEFAULT NULL, NEETEligibilite VARCHAR(255) DEFAULT NULL, NEETCommissionDate DATE DEFAULT NULL, FSEMaDemarcheCode TEXT DEFAULT NULL, datecontratIEJ DATE DEFAULT NULL, dateavenantIEJ DATE DEFAULT NULL, dispositifs_notes TEXT DEFAULT NULL, handicap BOOLEAN DEFAULT NULL, handicapnotes TEXT DEFAULT NULL, handicapRecommandation VARCHAR(50) DEFAULT NULL, mobilitemoyentransport JSONB DEFAULT NULL, mobilitenotes TEXT DEFAULT NULL, handicapAccompagnement_id INT DEFAULT NULL, documentCV_id INT DEFAULT NULL, documentAgrementIAE_id INT DEFAULT NULL, documentRQTH_id INT DEFAULT NULL, documentAttestationNEET_id INT DEFAULT NULL, documentCI_id INT DEFAULT NULL, documentTitreSejour_id INT DEFAULT NULL, documentAttestationFiscale_id INT DEFAULT NULL, documentPermis_id INT DEFAULT NULL, documentAttestationCAAF_id INT DEFAULT NULL, documentContraTravail_id INT DEFAULT NULL, documentAttestationFormation_id INT DEFAULT NULL, documentQuittanceLoyer_id INT DEFAULT NULL, documentFactureElectricite_id INT DEFAULT NULL, documentAttestationSecuriteSociale_id INT DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_10864F31217BBB47 ON chill_job.cs_person (person_id)'); + $this->addSql('CREATE INDEX IDX_10864F312654B57D ON chill_job.cs_person (handicapAccompagnement_id)'); + $this->addSql('CREATE INDEX IDX_10864F3154866550 ON chill_job.cs_person (documentCV_id)'); + $this->addSql('CREATE INDEX IDX_10864F318825E118 ON chill_job.cs_person (documentAgrementIAE_id)'); + $this->addSql('CREATE INDEX IDX_10864F31A396AFAC ON chill_job.cs_person (documentRQTH_id)'); + $this->addSql('CREATE INDEX IDX_10864F3187541764 ON chill_job.cs_person (documentAttestationNEET_id)'); + $this->addSql('CREATE INDEX IDX_10864F315CFC2299 ON chill_job.cs_person (documentCI_id)'); + $this->addSql('CREATE INDEX IDX_10864F3134FDF11D ON chill_job.cs_person (documentTitreSejour_id)'); + $this->addSql('CREATE INDEX IDX_10864F315742C99D ON chill_job.cs_person (documentAttestationFiscale_id)'); + $this->addSql('CREATE INDEX IDX_10864F31166494D4 ON chill_job.cs_person (documentPermis_id)'); + $this->addSql('CREATE INDEX IDX_10864F3172820D66 ON chill_job.cs_person (documentAttestationCAAF_id)'); + $this->addSql('CREATE INDEX IDX_10864F31AFA5E636 ON chill_job.cs_person (documentContraTravail_id)'); + $this->addSql('CREATE INDEX IDX_10864F3161E05C22 ON chill_job.cs_person (documentAttestationFormation_id)'); + $this->addSql('CREATE INDEX IDX_10864F316F744BB0 ON chill_job.cs_person (documentQuittanceLoyer_id)'); + $this->addSql('CREATE INDEX IDX_10864F31AC39B1B ON chill_job.cs_person (documentFactureElectricite_id)'); + $this->addSql('CREATE INDEX IDX_10864F3172A75B6D ON chill_job.cs_person (documentAttestationSecuriteSociale_id)'); + $this->addSql('CREATE INDEX IDX_10864F31D486E642 ON chill_job.cs_person (prescripteur_id)'); + $this->addSql('CREATE TABLE chill_job.cv (id INT NOT NULL, person_id INT DEFAULT NULL, reportDate DATE NOT NULL, formationLevel VARCHAR(255) DEFAULT NULL, formationType VARCHAR(255) DEFAULT NULL, spokenLanguages JSONB DEFAULT NULL, notes TEXT DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_3F24F812217BBB47 ON chill_job.cv (person_id)'); + $this->addSql('CREATE TABLE chill_job.cv_experience (id INT NOT NULL, poste TEXT DEFAULT NULL, structure TEXT DEFAULT NULL, startDate DATE DEFAULT NULL, endDate DATE DEFAULT NULL, contratType VARCHAR(100) NOT NULL, notes TEXT DEFAULT NULL, CV_id INT DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_102A1262AE1799D8 ON chill_job.cv_experience (CV_id)'); + $this->addSql('CREATE TABLE chill_job.cv_formation (id INT NOT NULL, title TEXT NOT NULL, startDate DATE DEFAULT NULL, endDate DATE DEFAULT NULL, diplomaObtained VARCHAR(255) DEFAULT NULL, diplomaReconnue VARCHAR(50) DEFAULT NULL, organisme TEXT DEFAULT NULL, CV_id INT DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_20BE09E2AE1799D8 ON chill_job.cv_formation (CV_id)'); + $this->addSql('CREATE TABLE chill_job.frein (id INT NOT NULL, reportDate DATE NOT NULL, freinsPerso JSONB NOT NULL, notesPerso TEXT NOT NULL, freinsEmploi JSONB NOT NULL, notesEmploi TEXT NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE chill_job.immersion (id INT NOT NULL, entreprise_id INT DEFAULT NULL, referent_id INT DEFAULT NULL, domaineActivite TEXT DEFAULT NULL, tuteurName TEXT DEFAULT NULL, tuteurFonction TEXT DEFAULT NULL, tuteurPhoneNumber TEXT DEFAULT NULL, structureAccName TEXT DEFAULT NULL, structureAccPhonenumber TEXT DEFAULT NULL, structureAccEmail TEXT DEFAULT NULL, posteDescriptif TEXT DEFAULT NULL, posteTitle TEXT DEFAULT NULL, posteLieu TEXT DEFAULT NULL, debutDate DATE DEFAULT NULL, duration INTERVAL DEFAULT NULL, horaire TEXT DEFAULT NULL, objectifs JSONB DEFAULT NULL, objectifsAutre TEXT DEFAULT NULL, is_bilan_fullfilled BOOLEAN DEFAULT false NOT NULL, savoirEtre JSONB DEFAULT NULL, savoirEtreNote TEXT DEFAULT NULL, noteimmersion TEXT, principalesActivites TEXT DEFAULT NULL, competencesAcquises TEXT DEFAULT NULL, competencesADevelopper TEXT DEFAULT NULL, noteBilan TEXT DEFAULT NULL, ponctualite_salarie TEXT DEFAULT NULL, ponctualite_salarie_note TEXT DEFAULT NULL, assiduite TEXT DEFAULT NULL, assiduite_note TEXT DEFAULT NULL, interet_activite TEXT DEFAULT NULL, interet_activite_note TEXT DEFAULT NULL, integre_regle TEXT DEFAULT NULL, integre_regle_note TEXT DEFAULT NULL, esprit_initiative TEXT DEFAULT NULL, esprit_initiative_note TEXT DEFAULT NULL, organisation TEXT DEFAULT NULL, organisation_note TEXT DEFAULT NULL, capacite_travail_equipe TEXT DEFAULT NULL, capacite_travail_equipe_note TEXT DEFAULT NULL, style_vestimentaire TEXT DEFAULT NULL, style_vestimentaire_note TEXT DEFAULT NULL, langage_prof TEXT DEFAULT NULL, langage_prof_note TEXT DEFAULT NULL, applique_consigne TEXT DEFAULT NULL, applique_consigne_note TEXT DEFAULT NULL, respect_hierarchie TEXT DEFAULT NULL, respect_hierarchie_note TEXT DEFAULT NULL, structureAccAddress_id INT DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_FBB3CBB4A4AEAFEA ON chill_job.immersion (entreprise_id)'); + $this->addSql('CREATE INDEX IDX_FBB3CBB435E47E35 ON chill_job.immersion (referent_id)'); + $this->addSql('CREATE INDEX IDX_FBB3CBB4B5E04267 ON chill_job.immersion (structureAccAddress_id)'); + $this->addSql('COMMENT ON COLUMN chill_job.immersion.duration IS \'(DC2Type:dateinterval)\''); + $this->addSql('CREATE TABLE chill_job.projet_professionnel (id INT NOT NULL, reportDate DATE NOT NULL, domaineActiviteSouhait TEXT DEFAULT NULL, typeContrat JSONB DEFAULT NULL, typeContratNotes TEXT DEFAULT NULL, volumeHoraire JSONB DEFAULT NULL, volumeHoraireNotes TEXT DEFAULT NULL, idee TEXT DEFAULT NULL, enCoursConstruction TEXT DEFAULT NULL, domaineActiviteValide TEXT DEFAULT NULL, valideNotes TEXT DEFAULT NULL, projetProfessionnelNote TEXT DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE chill_job.projetprofessionnel_souhait (projetprofessionnel_id INT NOT NULL, appellation_id INT NOT NULL, PRIMARY KEY(projetprofessionnel_id, appellation_id))'); + $this->addSql('CREATE INDEX IDX_3280B96DB87BF7B5 ON chill_job.projetprofessionnel_souhait (projetprofessionnel_id)'); + $this->addSql('CREATE INDEX IDX_3280B96D7CDE30DD ON chill_job.projetprofessionnel_souhait (appellation_id)'); + $this->addSql('CREATE TABLE chill_job.projetprofessionnel_valide (projetprofessionnel_id INT NOT NULL, appellation_id INT NOT NULL, PRIMARY KEY(projetprofessionnel_id, appellation_id))'); + $this->addSql('CREATE INDEX IDX_E0501BE0B87BF7B5 ON chill_job.projetprofessionnel_valide (projetprofessionnel_id)'); + $this->addSql('CREATE INDEX IDX_E0501BE07CDE30DD ON chill_job.projetprofessionnel_valide (appellation_id)'); + $this->addSql('CREATE TABLE chill_job.rome_appellation (id INT NOT NULL, metier_id INT DEFAULT NULL, code VARCHAR(40) NOT NULL, libelle TEXT NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_D9E9CABC77153098 ON chill_job.rome_appellation (code)'); + $this->addSql('CREATE INDEX IDX_D9E9CABCED16FA20 ON chill_job.rome_appellation (metier_id)'); + $this->addSql('CREATE TABLE chill_job.rome_metier (id INT NOT NULL, libelle TEXT NOT NULL, code VARCHAR(20) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_3274952577153098 ON chill_job.rome_metier (code)'); + $this->addSql('ALTER TABLE chill_job.cs_person ADD CONSTRAINT FK_10864F31217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cs_person ADD CONSTRAINT FK_10864F312654B57D FOREIGN KEY (handicapAccompagnement_id) REFERENCES chill_3party.third_party (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cs_person ADD CONSTRAINT FK_10864F3154866550 FOREIGN KEY (documentCV_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cs_person ADD CONSTRAINT FK_10864F318825E118 FOREIGN KEY (documentAgrementIAE_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cs_person ADD CONSTRAINT FK_10864F31A396AFAC FOREIGN KEY (documentRQTH_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cs_person ADD CONSTRAINT FK_10864F3187541764 FOREIGN KEY (documentAttestationNEET_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cs_person ADD CONSTRAINT FK_10864F315CFC2299 FOREIGN KEY (documentCI_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cs_person ADD CONSTRAINT FK_10864F3134FDF11D FOREIGN KEY (documentTitreSejour_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cs_person ADD CONSTRAINT FK_10864F315742C99D FOREIGN KEY (documentAttestationFiscale_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cs_person ADD CONSTRAINT FK_10864F31166494D4 FOREIGN KEY (documentPermis_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cs_person ADD CONSTRAINT FK_10864F3172820D66 FOREIGN KEY (documentAttestationCAAF_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cs_person ADD CONSTRAINT FK_10864F31AFA5E636 FOREIGN KEY (documentContraTravail_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cs_person ADD CONSTRAINT FK_10864F3161E05C22 FOREIGN KEY (documentAttestationFormation_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cs_person ADD CONSTRAINT FK_10864F316F744BB0 FOREIGN KEY (documentQuittanceLoyer_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cs_person ADD CONSTRAINT FK_10864F31AC39B1B FOREIGN KEY (documentFactureElectricite_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cs_person ADD CONSTRAINT FK_10864F3172A75B6D FOREIGN KEY (documentAttestationSecuriteSociale_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cs_person ADD CONSTRAINT FK_10864F31D486E642 FOREIGN KEY (prescripteur_id) REFERENCES chill_3party.third_party (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cv ADD CONSTRAINT FK_3F24F812217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cv_experience ADD CONSTRAINT FK_102A1262AE1799D8 FOREIGN KEY (CV_id) REFERENCES chill_job.cv (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.cv_formation ADD CONSTRAINT FK_20BE09E2AE1799D8 FOREIGN KEY (CV_id) REFERENCES chill_job.cv (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.immersion ADD CONSTRAINT FK_FBB3CBB4A4AEAFEA FOREIGN KEY (entreprise_id) REFERENCES chill_3party.third_party (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.immersion ADD CONSTRAINT FK_FBB3CBB435E47E35 FOREIGN KEY (referent_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.immersion ADD CONSTRAINT FK_FBB3CBB4B5E04267 FOREIGN KEY (structureAccAddress_id) REFERENCES chill_main_address (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.projetprofessionnel_souhait ADD CONSTRAINT FK_3280B96DB87BF7B5 FOREIGN KEY (projetprofessionnel_id) REFERENCES chill_job.projet_professionnel (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.projetprofessionnel_souhait ADD CONSTRAINT FK_3280B96D7CDE30DD FOREIGN KEY (appellation_id) REFERENCES chill_job.rome_appellation (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.projetprofessionnel_valide ADD CONSTRAINT FK_E0501BE0B87BF7B5 FOREIGN KEY (projetprofessionnel_id) REFERENCES chill_job.projet_professionnel (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.projetprofessionnel_valide ADD CONSTRAINT FK_E0501BE07CDE30DD FOREIGN KEY (appellation_id) REFERENCES chill_job.rome_appellation (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_job.rome_appellation ADD CONSTRAINT FK_D9E9CABCED16FA20 FOREIGN KEY (metier_id) REFERENCES chill_job.rome_metier (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + } + + public function down(Schema $schema): void + { + $this->addSql('DROP SEQUENCE chill_job.cv_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE chill_job.cv_experience_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE chill_job.cv_formation_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE chill_job.frein_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE chill_job.immersion_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE chill_job.projet_professionnel_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE chill_job.rome_appellation_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE chill_job.rome_metier_id_seq CASCADE'); + $this->addSql('ALTER TABLE chill_job.cs_person DROP CONSTRAINT FK_10864F31217BBB47'); + $this->addSql('ALTER TABLE chill_job.cs_person DROP CONSTRAINT FK_10864F312654B57D'); + $this->addSql('ALTER TABLE chill_job.cs_person DROP CONSTRAINT FK_10864F3154866550'); + $this->addSql('ALTER TABLE chill_job.cs_person DROP CONSTRAINT FK_10864F318825E118'); + $this->addSql('ALTER TABLE chill_job.cs_person DROP CONSTRAINT FK_10864F31A396AFAC'); + $this->addSql('ALTER TABLE chill_job.cs_person DROP CONSTRAINT FK_10864F3187541764'); + $this->addSql('ALTER TABLE chill_job.cs_person DROP CONSTRAINT FK_10864F315CFC2299'); + $this->addSql('ALTER TABLE chill_job.cs_person DROP CONSTRAINT FK_10864F3134FDF11D'); + $this->addSql('ALTER TABLE chill_job.cs_person DROP CONSTRAINT FK_10864F315742C99D'); + $this->addSql('ALTER TABLE chill_job.cs_person DROP CONSTRAINT FK_10864F31166494D4'); + $this->addSql('ALTER TABLE chill_job.cs_person DROP CONSTRAINT FK_10864F3172820D66'); + $this->addSql('ALTER TABLE chill_job.cs_person DROP CONSTRAINT FK_10864F31AFA5E636'); + $this->addSql('ALTER TABLE chill_job.cs_person DROP CONSTRAINT FK_10864F3161E05C22'); + $this->addSql('ALTER TABLE chill_job.cs_person DROP CONSTRAINT FK_10864F316F744BB0'); + $this->addSql('ALTER TABLE chill_job.cs_person DROP CONSTRAINT FK_10864F31AC39B1B'); + $this->addSql('ALTER TABLE chill_job.cs_person DROP CONSTRAINT FK_10864F3172A75B6D'); + $this->addSql('ALTER TABLE chill_job.cs_person DROP CONSTRAINT FK_10864F31D486E642'); + $this->addSql('ALTER TABLE chill_job.cv DROP CONSTRAINT FK_3F24F812217BBB47'); + $this->addSql('ALTER TABLE chill_job.cv_experience DROP CONSTRAINT FK_102A1262AE1799D8'); + $this->addSql('ALTER TABLE chill_job.cv_formation DROP CONSTRAINT FK_20BE09E2AE1799D8'); + $this->addSql('ALTER TABLE chill_job.immersion DROP CONSTRAINT FK_FBB3CBB4A4AEAFEA'); + $this->addSql('ALTER TABLE chill_job.immersion DROP CONSTRAINT FK_FBB3CBB435E47E35'); + $this->addSql('ALTER TABLE chill_job.immersion DROP CONSTRAINT FK_FBB3CBB4B5E04267'); + $this->addSql('ALTER TABLE chill_job.projetprofessionnel_souhait DROP CONSTRAINT FK_3280B96DB87BF7B5'); + $this->addSql('ALTER TABLE chill_job.projetprofessionnel_souhait DROP CONSTRAINT FK_3280B96D7CDE30DD'); + $this->addSql('ALTER TABLE chill_job.projetprofessionnel_valide DROP CONSTRAINT FK_E0501BE0B87BF7B5'); + $this->addSql('ALTER TABLE chill_job.projetprofessionnel_valide DROP CONSTRAINT FK_E0501BE07CDE30DD'); + $this->addSql('ALTER TABLE chill_job.rome_appellation DROP CONSTRAINT FK_D9E9CABCED16FA20'); + $this->addSql('DROP TABLE chill_job.cs_person'); + $this->addSql('DROP TABLE chill_job.cv'); + $this->addSql('DROP TABLE chill_job.cv_experience'); + $this->addSql('DROP TABLE chill_job.cv_formation'); + $this->addSql('DROP TABLE chill_job.frein'); + $this->addSql('DROP TABLE chill_job.immersion'); + $this->addSql('DROP TABLE chill_job.projet_professionnel'); + $this->addSql('DROP TABLE chill_job.projetprofessionnel_souhait'); + $this->addSql('DROP TABLE chill_job.projetprofessionnel_valide'); + $this->addSql('DROP TABLE chill_job.rome_appellation'); + $this->addSql('DROP TABLE chill_job.rome_metier'); + $this->addSql('DROP SCHEMA chill_job'); + } +} diff --git a/src/Bundle/ChillJobBundle/src/migrations/Version20240424140641.php b/src/Bundle/ChillJobBundle/src/migrations/Version20240424140641.php new file mode 100644 index 000000000..87c9d3623 --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/migrations/Version20240424140641.php @@ -0,0 +1,46 @@ +addSql('ALTER TABLE chill_job.frein ADD person_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_job.frein ADD CONSTRAINT FK_172EAC0A217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX IDX_172EAC0A217BBB47 ON chill_job.frein (person_id)'); + $this->addSql('ALTER TABLE chill_job.immersion ADD person_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_job.immersion ADD CONSTRAINT FK_FBB3CBB4217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX IDX_FBB3CBB4217BBB47 ON chill_job.immersion (person_id)'); + $this->addSql('ALTER TABLE chill_job.projet_professionnel ADD person_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_job.projet_professionnel ADD CONSTRAINT FK_12E4FFBF217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX IDX_12E4FFBF217BBB47 ON chill_job.projet_professionnel (person_id)'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_job.projet_professionnel DROP CONSTRAINT FK_12E4FFBF217BBB47'); + $this->addSql('ALTER TABLE chill_job.projet_professionnel DROP person_id'); + $this->addSql('ALTER TABLE chill_job.immersion DROP CONSTRAINT FK_FBB3CBB4217BBB47'); + $this->addSql('ALTER TABLE chill_job.immersion DROP person_id'); + $this->addSql('ALTER TABLE chill_job.frein DROP CONSTRAINT FK_172EAC0A217BBB47'); + $this->addSql('ALTER TABLE chill_job.frein DROP person_id'); + } +} diff --git a/src/Bundle/ChillJobBundle/src/migrations/Version20240429111628.php b/src/Bundle/ChillJobBundle/src/migrations/Version20240429111628.php new file mode 100644 index 000000000..e12318d7c --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/migrations/Version20240429111628.php @@ -0,0 +1,41 @@ +addSql('ALTER TABLE chill_job.immersion ALTER tuteurphonenumber TYPE VARCHAR(35)'); + $this->addSql('COMMENT ON COLUMN chill_job.immersion.tuteurPhoneNumber IS \'(DC2Type:phone_number)\''); + + $this->addSql('ALTER TABLE chill_job.immersion ALTER structureAccPhonenumber TYPE VARCHAR(35)'); + $this->addSql('COMMENT ON COLUMN chill_job.immersion.structureAccPhonenumber IS \'(DC2Type:phone_number)\''); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_job.immersion ALTER tuteurPhoneNumber TYPE TEXT'); + $this->addSql('COMMENT ON COLUMN chill_job.immersion.tuteurphonenumber IS NULL'); + + $this->addSql('ALTER TABLE chill_job.immersion ALTER structureAccPhonenumber TYPE TEXT'); + $this->addSql('COMMENT ON COLUMN chill_job.immersion.structureAccPhonenumber IS NULL'); + } +} diff --git a/src/Bundle/ChillJobBundle/src/migrations/old/Version20191119172511.php b/src/Bundle/ChillJobBundle/src/migrations/old/Version20191119172511.php new file mode 100644 index 000000000..6dccbec42 --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/migrations/old/Version20191119172511.php @@ -0,0 +1,114 @@ +skipIf(true, 'Skipping this old migration. Replaced by migration Version20240424095147'); + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('CREATE SCHEMA chill_csconnectes'); + $this->addSql('CREATE TABLE chill_csconnectes.cs_person ( + id INT NOT NULL, + person_id INT NOT NULL, + prescripteur_id INT DEFAULT NULL, + situationLogement VARCHAR(255) DEFAULT NULL, + enfantACharge INT DEFAULT NULL, + niveauMaitriseLangue JSONB DEFAULT NULL, + vehiculePersonnel BOOLEAN DEFAULT NULL, + permisConduire JSONB DEFAULT NULL, + situationProfessionnelle VARCHAR(255) DEFAULT NULL, + dateFinDernierEmploi DATE DEFAULT NULL, + typeContrat JSONB DEFAULT NULL, + ressources JSONB DEFAULT NULL, + ressourcesComment TEXT DEFAULT NULL, + ressourceDate1Versement DATE DEFAULT NULL, + CPFNombreHeures INT DEFAULT NULL, + accompagnement JSONB DEFAULT NULL, + accompagnementRQTHDate DATE DEFAULT NULL, + accompagnementComment VARCHAR(255) DEFAULT NULL, + poleEmploiId VARCHAR(255) DEFAULT NULL, + poleEmploiInscriptionDate DATE DEFAULT NULL, + cafId VARCHAR(255) DEFAULT NULL, + cafInscriptionDate DATE DEFAULT NULL, + CERInscriptionDate DATE DEFAULT NULL, + PPAEInscriptionDate DATE DEFAULT NULL, + NEETEligibilite BOOLEAN DEFAULT NULL, + NEETCommissionDate DATE DEFAULT NULL, + FSEMaDemarcheCode TEXT DEFAULT NULL, + documentCV_id INT DEFAULT NULL, + documentAgrementIAE_id INT DEFAULT NULL, + documentRQTH_id INT DEFAULT NULL, + documentAttestationNEET_id INT DEFAULT NULL, + documentCI_id INT DEFAULT NULL, + documentTitreSejour_id INT DEFAULT NULL, + documentAttestationFiscale_id INT DEFAULT NULL, + documentPermis_id INT DEFAULT NULL, + documentAttestationCAAF_id INT DEFAULT NULL, + documentContraTravail_id INT DEFAULT NULL, + documentAttestationFormation_id INT DEFAULT NULL, + documentQuittanceLoyer_id INT DEFAULT NULL, + documentFactureElectricite_id INT DEFAULT NULL, + PRIMARY KEY(id, person_id))'); + $this->addSql('CREATE INDEX IDX_10864F31217BBB47 ON chill_csconnectes.cs_person (person_id)'); + $this->addSql('CREATE INDEX IDX_10864F3154866550 ON chill_csconnectes.cs_person (documentCV_id)'); + $this->addSql('CREATE INDEX IDX_10864F318825E118 ON chill_csconnectes.cs_person (documentAgrementIAE_id)'); + $this->addSql('CREATE INDEX IDX_10864F31A396AFAC ON chill_csconnectes.cs_person (documentRQTH_id)'); + $this->addSql('CREATE INDEX IDX_10864F3187541764 ON chill_csconnectes.cs_person (documentAttestationNEET_id)'); + $this->addSql('CREATE INDEX IDX_10864F315CFC2299 ON chill_csconnectes.cs_person (documentCI_id)'); + $this->addSql('CREATE INDEX IDX_10864F3134FDF11D ON chill_csconnectes.cs_person (documentTitreSejour_id)'); + $this->addSql('CREATE INDEX IDX_10864F315742C99D ON chill_csconnectes.cs_person (documentAttestationFiscale_id)'); + $this->addSql('CREATE INDEX IDX_10864F31166494D4 ON chill_csconnectes.cs_person (documentPermis_id)'); + $this->addSql('CREATE INDEX IDX_10864F3172820D66 ON chill_csconnectes.cs_person (documentAttestationCAAF_id)'); + $this->addSql('CREATE INDEX IDX_10864F31AFA5E636 ON chill_csconnectes.cs_person (documentContraTravail_id)'); + $this->addSql('CREATE INDEX IDX_10864F3161E05C22 ON chill_csconnectes.cs_person (documentAttestationFormation_id)'); + $this->addSql('CREATE INDEX IDX_10864F316F744BB0 ON chill_csconnectes.cs_person (documentQuittanceLoyer_id)'); + $this->addSql('CREATE INDEX IDX_10864F31AC39B1B ON chill_csconnectes.cs_person (documentFactureElectricite_id)'); + $this->addSql('CREATE INDEX IDX_10864F31D486E642 ON chill_csconnectes.cs_person (prescripteur_id)'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD CONSTRAINT FK_10864F31217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD CONSTRAINT FK_10864F3154866550 FOREIGN KEY (documentCV_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD CONSTRAINT FK_10864F318825E118 FOREIGN KEY (documentAgrementIAE_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD CONSTRAINT FK_10864F31A396AFAC FOREIGN KEY (documentRQTH_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD CONSTRAINT FK_10864F3187541764 FOREIGN KEY (documentAttestationNEET_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD CONSTRAINT FK_10864F315CFC2299 FOREIGN KEY (documentCI_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD CONSTRAINT FK_10864F3134FDF11D FOREIGN KEY (documentTitreSejour_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD CONSTRAINT FK_10864F315742C99D FOREIGN KEY (documentAttestationFiscale_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD CONSTRAINT FK_10864F31166494D4 FOREIGN KEY (documentPermis_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD CONSTRAINT FK_10864F3172820D66 FOREIGN KEY (documentAttestationCAAF_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD CONSTRAINT FK_10864F31AFA5E636 FOREIGN KEY (documentContraTravail_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD CONSTRAINT FK_10864F3161E05C22 FOREIGN KEY (documentAttestationFormation_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD CONSTRAINT FK_10864F316F744BB0 FOREIGN KEY (documentQuittanceLoyer_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD CONSTRAINT FK_10864F31AC39B1B FOREIGN KEY (documentFactureElectricite_id) REFERENCES chill_doc.stored_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD CONSTRAINT FK_10864F31D486E642 FOREIGN KEY (prescripteur_id) REFERENCES chill_3party.third_party (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.cs_person.niveauMaitriseLangue IS NULL'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.cs_person.permisConduire IS NULL'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.cs_person.typeContrat IS NULL'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.cs_person.ressources IS NULL'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.cs_person.accompagnement IS NULL'); + } + + public function down(Schema $schema): void + { + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('DROP TABLE chill_csconnectes.cs_person'); + $this->addSql('DROP SCHEMA chill_csconnectes CASCADE'); + } +} diff --git a/src/Bundle/ChillJobBundle/src/migrations/old/Version20191129112321.php b/src/Bundle/ChillJobBundle/src/migrations/old/Version20191129112321.php new file mode 100644 index 000000000..85ca4e137 --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/migrations/old/Version20191129112321.php @@ -0,0 +1,60 @@ +skipIf(true, 'Skipping this old migration. Replaced by migration Version20240424095147'); + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('DROP INDEX chill_csconnectes.IDX_10864f31217bbb47'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD CERSignataire TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD PPAESignataire TEXT DEFAULT NULL'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.cs_person.niveauMaitriseLangue IS NULL'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.cs_person.permisConduire IS NULL'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.cs_person.typeContrat IS NULL'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.cs_person.ressources IS NULL'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.cs_person.accompagnement IS NULL'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_10864F31217BBB47 ON chill_csconnectes.cs_person (person_id)'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person DROP CONSTRAINT cs_person_pkey'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD PRIMARY KEY (id)'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ALTER person_id DROP NOT NULL'); + } + + public function down(Schema $schema): void + { + $this->throwIrreversibleMigrationException('this migration is not reversible (' + .'actions on primary keys)'); + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('DROP INDEX UNIQ_10864F31217BBB47'); + $this->addSql('DROP INDEX cs_person_pkey'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person DROP CERSignataire'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person DROP PPAESignataire'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ALTER person_id SET NOT NULL'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.cs_person.niveaumaitriselangue IS \'(DC2Type:json_array)\''); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.cs_person.permisconduire IS \'(DC2Type:json_array)\''); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.cs_person.typecontrat IS \'(DC2Type:json_array)\''); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.cs_person.ressources IS \'(DC2Type:json_array)\''); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.cs_person.accompagnement IS \'(DC2Type:json_array)\''); + $this->addSql('CREATE INDEX idx_10864f31217bbb47 ON chill_csconnectes.cs_person (person_id)'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD PRIMARY KEY (id, person_id)'); + } +} diff --git a/src/Bundle/ChillJobBundle/src/migrations/old/Version20200113104411.php b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200113104411.php new file mode 100644 index 000000000..1fb74f5f0 --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200113104411.php @@ -0,0 +1,53 @@ +skipIf(true, 'Skipping this old migration. Replaced by migration Version20240424095147'); + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('CREATE SEQUENCE chill_csconnectes.immersion_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE TABLE chill_csconnectes.immersion (id INT NOT NULL, person_id INT DEFAULT NULL, entreprise_id INT DEFAULT NULL, referent_id INT DEFAULT NULL, domaineActivite TEXT DEFAULT NULL, tuteurName TEXT DEFAULT NULL, tuteurFonction TEXT DEFAULT NULL, tuteurPhoneNumber TEXT DEFAULT NULL, structureAccName TEXT DEFAULT NULL, structureAccPhonenumber TEXT DEFAULT NULL, posteDescriptif TEXT DEFAULT NULL, posteTitle TEXT DEFAULT NULL, posteLieu TEXT DEFAULT NULL, debutDate DATE DEFAULT NULL, duration INTERVAL DEFAULT NULL, horaire TEXT DEFAULT NULL, objectifs JSONB DEFAULT NULL, savoirEtre JSONB DEFAULT NULL, noteimmersion TEXT NOT NULL, principalesActivites TEXT DEFAULT NULL, competencesAcquises TEXT DEFAULT NULL, competencesADevelopper TEXT DEFAULT NULL, noteBilan TEXT DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_FBB3CBB4217BBB47 ON chill_csconnectes.immersion (person_id)'); + $this->addSql('CREATE INDEX IDX_FBB3CBB4A4AEAFEA ON chill_csconnectes.immersion (entreprise_id)'); + $this->addSql('CREATE INDEX IDX_FBB3CBB435E47E35 ON chill_csconnectes.immersion (referent_id)'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.immersion.duration IS \'(DC2Type:dateinterval)\''); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD CONSTRAINT FK_FBB3CBB4217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD CONSTRAINT FK_FBB3CBB4A4AEAFEA FOREIGN KEY (entreprise_id) REFERENCES chill_3party.third_party (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD CONSTRAINT FK_FBB3CBB435E47E35 FOREIGN KEY (referent_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + + $this->addSql('CREATE TABLE chill_csconnectes.cv_formation (id INT NOT NULL, title TEXT NOT NULL, startDate DATE DEFAULT NULL, endDate DATE DEFAULT NULL, diplomaObtained VARCHAR(255) DEFAULT NULL, diplomaReconnue VARCHAR(50) DEFAULT NULL, organisme TEXT DEFAULT NULL, CV_id INT DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_20BE09E2AE1799D8 ON chill_csconnectes.cv_formation (CV_id)'); + $this->addSql('ALTER TABLE chill_csconnectes.cv_formation ADD CONSTRAINT FK_20BE09E2AE1799D8 FOREIGN KEY (CV_id) REFERENCES chill_csconnectes.cv (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + } + + public function down(Schema $schema): void + { + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('DROP SEQUENCE chill_csconnectes.immersion_id_seq CASCADE'); + $this->addSql('DROP TABLE chill_csconnectes.immersion'); + + $this->addSql('DROP SEQUENCE chill_csconnectes.cv_formation_id_seq CASCADE'); + $this->addSql('ALTER TABLE chill_csconnectes.cv_formation DROP CONSTRAINT FK_20BE09E2AE1799D8'); + $this->addSql('DROP TABLE chill_csconnectes.cv_formation'); + } +} diff --git a/src/Bundle/ChillJobBundle/src/migrations/old/Version20200113142525.php b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200113142525.php new file mode 100644 index 000000000..cabc97d59 --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200113142525.php @@ -0,0 +1,43 @@ +skipIf(true, 'Skipping this old migration. Replaced by migration Version20240424095147'); + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD structureAccEmail TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD structureAccAddress_id INT DEFAULT NULL'); + $this->addSql('CREATE INDEX IDX_FBB3CBB4B5E04267 ON chill_csconnectes.immersion (structureAccAddress_id)'); + } + + public function down(Schema $schema): void + { + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP structureAccEmail'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP structureAccAddress_id'); + } +} diff --git a/src/Bundle/ChillJobBundle/src/migrations/old/Version20200114081435.php b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200114081435.php new file mode 100644 index 000000000..a03263bf3 --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200114081435.php @@ -0,0 +1,44 @@ +skipIf(true, 'Skipping this old migration. Replaced by migration Version20240424095147'); + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD is_bilan_fullfilled BOOLEAN DEFAULT \'false\' NOT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD savoirEtreNote TEXT DEFAULT NULL'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.immersion.savoirEtre IS NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD CONSTRAINT FK_FBB3CBB4B5E04267 FOREIGN KEY (structureAccAddress_id) REFERENCES chill_main_address (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + } + + public function down(Schema $schema): void + { + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP CONSTRAINT FK_FBB3CBB4B5E04267'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP is_bilan_fullfilled'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP savoirEtreNote'); + } +} diff --git a/src/Bundle/ChillJobBundle/src/migrations/old/Version20200124130244.php b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200124130244.php new file mode 100644 index 000000000..dd1e669ae --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200124130244.php @@ -0,0 +1,36 @@ +skipIf(true, 'Skipping this old migration. Replaced by migration Version20240424095147'); + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD datecontratIEJ DATE DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('ALTER TABLE chill_csconnectes.cs_person DROP datecontratIEJ'); + } +} diff --git a/src/Bundle/ChillJobBundle/src/migrations/old/Version20200124132321.php b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200124132321.php new file mode 100644 index 000000000..3cf1b3019 --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200124132321.php @@ -0,0 +1,36 @@ +skipIf(true, 'Skipping this old migration. Replaced by migration Version20240424095147'); + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD typeContratAide TEXT DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('ALTER TABLE chill_csconnectes.cs_person DROP typeContratAide'); + } +} diff --git a/src/Bundle/ChillJobBundle/src/migrations/old/Version20200127132932.php b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200127132932.php new file mode 100644 index 000000000..2907c2155 --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200127132932.php @@ -0,0 +1,36 @@ +skipIf(true, 'Skipping this old migration. Replaced by migration Version20240424095147'); + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD objectifsAutre TEXT DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP objectifsAutre'); + } +} diff --git a/src/Bundle/ChillJobBundle/src/migrations/old/Version20200205132532.php b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200205132532.php new file mode 100644 index 000000000..1372aa308 --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200205132532.php @@ -0,0 +1,83 @@ +skipIf(true, 'Skipping this old migration. Replaced by migration Version20240424095147'); + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + // $this->addSql('DROP SEQUENCE report_id_seq CASCADE'); + $this->addSql('CREATE SEQUENCE chill_csconnectes.rome_appellation_id_seq ' + .'INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE chill_csconnectes.rome_metier_id_seq ' + .'INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE chill_csconnectes.projet_professionnel_id_seq ' + .'INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE chill_csconnectes.cv_formation_id_seq ' + .'INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE TABLE chill_csconnectes.rome_appellation (' + .'id INT NOT NULL, metier_id INT DEFAULT NULL, code VARCHAR(40) NOT NULL, ' + .'libelle TEXT NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_D9E9CABCED16FA20 ON chill_csconnectes.rome_appellation (metier_id)'); + $this->addSql('CREATE TABLE chill_csconnectes.rome_metier (id INT NOT NULL, ' + .'libelle TEXT NOT NULL, code VARCHAR(20) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE chill_csconnectes.projet_professionnel (id INT NOT NULL, ' + .'person_id INT DEFAULT NULL, reportDate DATE NOT NULL, ' + .'typeContrat JSONB DEFAULT NULL, typeContratNotes TEXT DEFAULT NULL, ' + .'volumeHoraire JSONB DEFAULT NULL, volumeHoraireNotes TEXT DEFAULT NULL, ' + .'idee TEXT DEFAULT NULL, enCoursConstruction TEXT DEFAULT NULL, ' + .'valideNotes TEXT DEFAULT NULL, projetProfessionnelNote TEXT DEFAULT NULL, ' + .'PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_12E4FFBF217BBB47 ON chill_csconnectes.projet_professionnel (person_id)'); + $this->addSql('CREATE TABLE chill_csconnectes.projetprofessionnel_souhait (projetprofessionnel_id INT NOT NULL, appellation_id INT NOT NULL, PRIMARY KEY(projetprofessionnel_id, appellation_id))'); + $this->addSql('CREATE INDEX IDX_3280B96DB87BF7B5 ON chill_csconnectes.projetprofessionnel_souhait (projetprofessionnel_id)'); + $this->addSql('CREATE INDEX IDX_3280B96D7CDE30DD ON chill_csconnectes.projetprofessionnel_souhait (appellation_id)'); + $this->addSql('CREATE TABLE chill_csconnectes.projetprofessionnel_valide (projetprofessionnel_id INT NOT NULL, appellation_id INT NOT NULL, PRIMARY KEY(projetprofessionnel_id, appellation_id))'); + $this->addSql('CREATE INDEX IDX_E0501BE0B87BF7B5 ON chill_csconnectes.projetprofessionnel_valide (projetprofessionnel_id)'); + $this->addSql('CREATE INDEX IDX_E0501BE07CDE30DD ON chill_csconnectes.projetprofessionnel_valide (appellation_id)'); + $this->addSql('ALTER TABLE chill_csconnectes.rome_appellation ADD CONSTRAINT FK_D9E9CABCED16FA20 FOREIGN KEY (metier_id) REFERENCES chill_csconnectes.rome_metier (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.projet_professionnel ADD CONSTRAINT FK_12E4FFBF217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.projetprofessionnel_souhait ADD CONSTRAINT FK_3280B96DB87BF7B5 FOREIGN KEY (projetprofessionnel_id) REFERENCES chill_csconnectes.projet_professionnel (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.projetprofessionnel_souhait ADD CONSTRAINT FK_3280B96D7CDE30DD FOREIGN KEY (appellation_id) REFERENCES chill_csconnectes.rome_appellation (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.projetprofessionnel_valide ADD CONSTRAINT FK_E0501BE0B87BF7B5 FOREIGN KEY (projetprofessionnel_id) REFERENCES chill_csconnectes.projet_professionnel (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE chill_csconnectes.projetprofessionnel_valide ADD CONSTRAINT FK_E0501BE07CDE30DD FOREIGN KEY (appellation_id) REFERENCES chill_csconnectes.rome_appellation (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + } + + public function down(Schema $schema): void + { + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('ALTER TABLE chill_csconnectes.projetprofessionnel_souhait DROP CONSTRAINT FK_3280B96D7CDE30DD'); + $this->addSql('ALTER TABLE chill_csconnectes.projetprofessionnel_valide DROP CONSTRAINT FK_E0501BE07CDE30DD'); + $this->addSql('ALTER TABLE chill_csconnectes.rome_appellation DROP CONSTRAINT FK_D9E9CABCED16FA20'); + $this->addSql('ALTER TABLE chill_csconnectes.projetprofessionnel_souhait DROP CONSTRAINT FK_3280B96DB87BF7B5'); + $this->addSql('ALTER TABLE chill_csconnectes.projetprofessionnel_valide DROP CONSTRAINT FK_E0501BE0B87BF7B5'); + $this->addSql('DROP SEQUENCE chill_csconnectes.rome_appellation_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE chill_csconnectes.rome_metier_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE chill_csconnectes.projet_professionnel_id_seq CASCADE'); + + $this->addSql('DROP TABLE chill_csconnectes.rome_appellation'); + $this->addSql('DROP TABLE chill_csconnectes.rome_metier'); + $this->addSql('DROP TABLE chill_csconnectes.projet_professionnel'); + $this->addSql('DROP TABLE chill_csconnectes.projetprofessionnel_souhait'); + $this->addSql('DROP TABLE chill_csconnectes.projetprofessionnel_valide'); + } +} diff --git a/src/Bundle/ChillJobBundle/src/migrations/old/Version20200207224152.php b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200207224152.php new file mode 100644 index 000000000..6fecfda82 --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200207224152.php @@ -0,0 +1,38 @@ +skipIf(true, 'Skipping this old migration. Replaced by migration Version20240424095147'); + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('CREATE INDEX code_appellation_idx ON chill_csconnectes.rome_appellation (code)'); + $this->addSql('CREATE INDEX code_metier_idx ON chill_csconnectes.rome_metier (code)'); + } + + public function down(Schema $schema): void + { + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('DROP INDEX code_appellation_idx ON chill_csconnectes.rome_appellation'); + $this->addSql('DROP INDEX code_metier_idx ON chill_csconnectes.rome_metier'); + } +} diff --git a/src/Bundle/ChillJobBundle/src/migrations/old/Version20200210105342.php b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200210105342.php new file mode 100644 index 000000000..53d88ec2b --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200210105342.php @@ -0,0 +1,36 @@ +skipIf(true, 'Skipping this old migration. Replaced by migration Version20240424095147'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_D9E9CABC77153098 ON chill_csconnectes.rome_appellation (code);'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_3274952577153098 ON chill_csconnectes.rome_metier (code);'); + $this->addSql('DROP INDEX IF EXISTS chill_csconnectes.code_metier_idx '); + $this->addSql('DROP INDEX IF EXISTS chill_csconnectes.code_appellation_idx '); + } + + public function down(Schema $schema): void + { + $this->addSql('DROP INDEX chill_csconnectes.UNIQ_D9E9CABC77153098'); + $this->addSql('DROP INDEX chill_csconnectes.UNIQ_3274952577153098'); + } +} diff --git a/src/Bundle/ChillJobBundle/src/migrations/old/Version20200313124323.php b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200313124323.php new file mode 100644 index 000000000..1c3ef3be4 --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200313124323.php @@ -0,0 +1,87 @@ +skipIf(true, 'Skipping this old migration. Replaced by migration Version20240424095147'); + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + $this->addSql('ALTER TABLE chill_csconnectes.cv_formation ALTER diplomaobtained TYPE VARCHAR(255)'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD ponctualite_salarie TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD ponctualite_salarie_note TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD assiduite TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD assiduite_note TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD interet_activite TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD interet_activite_note TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD integre_regle TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD integre_regle_note TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD esprit_initiative TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD esprit_initiative_note TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD organisation TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD organisation_note TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD capacite_travail_equipe TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD capacite_travail_equipe_note TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD style_vestimentaire TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD style_vestimentaire_note TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD langage_prof TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD langage_prof_note TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD applique_consigne TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD applique_consigne_note TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD respect_hierarchie TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion ADD respect_hierarchie_note TEXT DEFAULT NULL'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.immersion.objectifs IS NULL'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.immersion.savoirEtre IS NULL'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.frein.freinsPerso IS NULL'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.frein.freinsEmploi IS NULL'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.projet_professionnel.typeContrat IS NULL'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.projet_professionnel.volumeHoraire IS NULL'); + $this->addSql('COMMENT ON COLUMN chill_3party.third_party.types IS NULL'); + } + + public function down(Schema $schema): void + { + $this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP ponctualite_salarie'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP ponctualite_salarie_note'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP assiduite'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP assiduite_note'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP interet_activite'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP interet_activite_note'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP integre_regle'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP integre_regle_note'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP esprit_initiative'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP esprit_initiative_note'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP organisation'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP organisation_note'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP capacite_travail_equipe'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP capacite_travail_equipe_note'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP style_vestimentaire'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP style_vestimentaire_note'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP langage_prof'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP langage_prof_note'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP applique_consigne'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP applique_consigne_note'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP respect_hierarchie'); + $this->addSql('ALTER TABLE chill_csconnectes.immersion DROP respect_hierarchie_note'); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.immersion.objectifs IS \'(DC2Type:json_array)\''); + $this->addSql('COMMENT ON COLUMN chill_csconnectes.immersion.savoiretre IS \'(DC2Type:json_array)\''); + } +} diff --git a/src/Bundle/ChillJobBundle/src/migrations/old/Version20200403114520.php b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200403114520.php new file mode 100644 index 000000000..ab80c48d7 --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200403114520.php @@ -0,0 +1,35 @@ +skipIf(true, 'Skipping this old migration. Replaced by migration Version20240424095147'); + $this->addSql('ALTER TABLE chill_csconnectes.projet_professionnel ADD domaineActiviteSouhait TEXT DEFAULT NULL;'); + $this->addSql('ALTER TABLE chill_csconnectes.projet_professionnel ADD domaineActiviteValide TEXT DEFAULT NULL;'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_csconnectes.projet_professionnel DROP domaineActiviteSouhait'); + $this->addSql('ALTER TABLE chill_csconnectes.projet_professionnel DROP domaineActiviteValide'); + } +} diff --git a/src/Bundle/ChillJobBundle/src/migrations/old/Version20200403123148.php b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200403123148.php new file mode 100644 index 000000000..307cd14c7 --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/migrations/old/Version20200403123148.php @@ -0,0 +1,32 @@ +skipIf(true, 'Skipping this old migration. Replaced by migration Version20240424095147'); + $this->addSql('ALTER TABLE chill_csconnectes.cs_person ADD dateavenantIEJ DATE DEFAULT NULL;'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_csconnectes.cs_person DROP dateavenantIEJ'); + } +} diff --git a/src/Bundle/ChillMainBundle/CRUD/CompilerPass/CRUDControllerCompilerPass.php b/src/Bundle/ChillMainBundle/CRUD/CompilerPass/CRUDControllerCompilerPass.php index c3c7b9dc1..601dc9833 100644 --- a/src/Bundle/ChillMainBundle/CRUD/CompilerPass/CRUDControllerCompilerPass.php +++ b/src/Bundle/ChillMainBundle/CRUD/CompilerPass/CRUDControllerCompilerPass.php @@ -11,6 +11,9 @@ declare(strict_types=1); namespace Chill\MainBundle\CRUD\CompilerPass; +use Chill\MainBundle\CRUD\Controller\ApiController; +use Chill\MainBundle\CRUD\Controller\CRUDController; +use Chill\MainBundle\CRUD\Exception\InvalidCrudConfiguration; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -38,6 +41,9 @@ class CRUDControllerCompilerPass implements CompilerPassInterface private function configureCrudController(ContainerBuilder $container, array $crudEntry, string $apiOrCrud): void { $controllerClass = $crudEntry['controller']; + if (ApiController::class === $controllerClass || CRUDController::class === $controllerClass) { + throw InvalidCrudConfiguration::configurationRequiresControllerDefinition($crudEntry['class'], $apiOrCrud); + } $controllerServiceName = 'cs'.$apiOrCrud.'_'.$crudEntry['name'].'_controller'; // create config parameter in container diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php index 9ee0d9e19..ea5e55a69 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php @@ -18,10 +18,13 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Doctrine\DBAL\LockMode; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\QueryBuilder; +use Doctrine\Persistence\ManagerRegistry; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\ConflictHttpException; use Symfony\Component\Serializer\SerializerInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; @@ -60,7 +63,7 @@ abstract class AbstractCRUDController extends AbstractController parent::getSubscribedServices(), [ 'chill_main.paginator_factory' => PaginatorFactory::class, - + ManagerRegistry::class => ManagerRegistry::class, 'translator' => TranslatorInterface::class, AuthorizationHelper::class => AuthorizationHelper::class, EventDispatcherInterface::class => EventDispatcherInterface::class, @@ -95,7 +98,7 @@ abstract class AbstractCRUDController extends AbstractController */ protected function buildQueryEntities(string $action, Request $request) { - $qb = $this->getDoctrine()->getManager() + $qb = $this->getManagerRegistry()->getManager() ->createQueryBuilder() ->select('e') ->from($this->getEntityClass(), 'e'); @@ -116,7 +119,7 @@ abstract class AbstractCRUDController extends AbstractController * * @param mixed|null $entity * - * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedHttpException + * @throws AccessDeniedHttpException */ protected function checkACL(string $action, Request $request, string $_format, $entity = null) { @@ -145,9 +148,7 @@ 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) { @@ -169,8 +170,7 @@ abstract class AbstractCRUDController extends AbstractController */ protected function getEntity(mixed $action, string $id, Request $request): object { - $e = $this - ->getDoctrine() + $e = $this->getManagerRegistry() ->getRepository($this->getEntityClass()) ->find($id); @@ -181,7 +181,7 @@ abstract class AbstractCRUDController extends AbstractController $expectedVersion = $request->query->getInt('entity_version'); try { - $manager = $this->getDoctrine()->getManagerForClass($this->getEntityClass()); + $manager = $this->getManagerRegistry()->getManagerForClass($this->getEntityClass()); if ($manager instanceof EntityManagerInterface) { $manager->lock($e, LockMode::OPTIMISTIC, $expectedVersion); @@ -211,6 +211,11 @@ abstract class AbstractCRUDController extends AbstractController return $this->container->get('chill_main.paginator_factory'); } + protected function getManagerRegistry(): ManagerRegistry + { + return $this->container->get(ManagerRegistry::class); + } + /** * Get the result of the query. */ diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php index a6675424e..6533da243 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php @@ -80,8 +80,8 @@ class ApiController extends AbstractCRUDController return $response; } - $this->getDoctrine()->getManager()->remove($entity); - $this->getDoctrine()->getManager()->flush(); + $this->getManagerRegistry()->getManager()->remove($entity); + $this->getManagerRegistry()->getManager()->flush(); $response = $this->onAfterFlush($action, $request, $_format, $entity, $errors); @@ -153,7 +153,7 @@ class ApiController extends AbstractCRUDController return $response; } - $this->getDoctrine()->getManagerForClass($this->getEntityClass())->flush(); + $this->getManagerRegistry()->getManagerForClass($this->getEntityClass())->flush(); $response = $this->onAfterFlush($action, $request, $_format, $entity, $errors); @@ -269,10 +269,10 @@ class ApiController extends AbstractCRUDController } if ($forcePersist && Request::METHOD_POST === $request->getMethod()) { - $this->getDoctrine()->getManager()->persist($postedData); + $this->getManagerRegistry()->getManager()->persist($postedData); } - $this->getDoctrine()->getManager()->flush(); + $this->getManagerRegistry()->getManager()->flush(); $response = $this->onAfterFlush($action, $request, $_format, $entity, $errors, [$postedData]); @@ -373,7 +373,7 @@ class ApiController extends AbstractCRUDController try { $entity = $this->deserialize($action, $request, $_format, $entity); } catch (NotEncodableValueException $e) { - throw new BadRequestHttpException('invalid json', 400, $e); + throw new BadRequestHttpException('invalid json', $e, 400); } $errors = $this->validate($action, $request, $_format, $entity); @@ -403,8 +403,8 @@ class ApiController extends AbstractCRUDController return $response; } - $this->getDoctrine()->getManager()->persist($entity); - $this->getDoctrine()->getManager()->flush(); + $this->getManagerRegistry()->getManager()->persist($entity); + $this->getManagerRegistry()->getManager()->flush(); $response = $this->onAfterFlush($action, $request, $_format, $entity, $errors); diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php index 951b7b875..19e9014da 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php @@ -19,16 +19,40 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\MainBundle\Templating\Listing\FilterOrderHelper; use Chill\MainBundle\Templating\Listing\FilterOrderHelperFactoryInterface; use Doctrine\ORM\QueryBuilder; +use Doctrine\Persistence\ManagerRegistry; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; -use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Serializer\SerializerInterface; use Symfony\Contracts\Translation\TranslatorInterface; +/** + * The CRUDController class is an abstract class that provides basic CRUD (Create, Read, Update, Delete) functionality for entities in a Symfony application. It extends the Abstract + *Controller class. + * + * For the class \Chill\MainBundle\CRUD\Controller\CRUDController, the dependency injection system does not work as in + * the usual way, where dependencies are provided via the constructor method. Instead, it utilizes the capabilities + * provided by the \Symfony\Contracts\Service\ServiceSubscriberInterface. + * + * The \Symfony\Contracts\Service\ServiceSubscriberInterface is an interface that is used by objects needing explicit + * service references. It means this class has a direct dependency on the Symfony service container, allowing it to + * request specific services it needs for execution. + * + * By implementing the ServiceSubscriberInterface, this class effectively defines a method called getSubscribedServices, + * which returns an array mapping service IDs to their classes or interfaces. Symfony's service container uses this + * method to preconfigure the services required, optimizing the dependency injection process. + * + * This model can be used to keep the class itself concise by preventing the need to define a constructor and inject + * services through method calls. This approach also allows for more flexible service usage, as services can be fetched + * as and when required, rather than all services being loaded whether they are used or not. This makes for a more + * efficient and maintainable solution especially when dealing with larger services. + * + * For more details about how this works, you can refer to Symfony's Documentation + * on Service Subscribers & Service Locators: https://symfony.com/doc/current/service_container/service_subscribers_locators.html + */ class CRUDController extends AbstractController { /** @@ -78,6 +102,7 @@ class CRUDController extends AbstractController Resolver::class => Resolver::class, SerializerInterface::class => SerializerInterface::class, FilterOrderHelperFactoryInterface::class => FilterOrderHelperFactoryInterface::class, + ManagerRegistry::class => ManagerRegistry::class, ] ); } @@ -150,8 +175,7 @@ class CRUDController extends AbstractController */ protected function buildQueryEntities(string $action, Request $request) { - $query = $this - ->getDoctrine() + $query = $this->getManagerRegistry() ->getManager() ->createQueryBuilder() ->select('e') @@ -224,13 +248,9 @@ 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 @@ -269,7 +289,7 @@ class CRUDController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { $this->onFormValid($action, $entity, $form, $request); - $em = $this->getDoctrine()->getManager(); + $em = $this->getManagerRegistry()->getManager(); $this->onPreRemove($action, $entity, $form, $request); $this->removeEntity($action, $entity, $form, $request); @@ -314,7 +334,7 @@ class CRUDController extends AbstractController $id = $request->query->get('duplicate_id', 0); $originalEntity = $this->getEntity($action, $id, $request); - $this->getDoctrine()->getManager() + $this->getManagerRegistry()->getManager() ->detach($originalEntity); return $originalEntity; @@ -386,7 +406,7 @@ class CRUDController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { $this->onFormValid($action, $entity, $form, $request); - $em = $this->getDoctrine()->getManager(); + $em = $this->getManagerRegistry()->getManager(); $this->onPrePersist($action, $entity, $form, $request); $em->persist($entity); @@ -489,7 +509,7 @@ class CRUDController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { $this->onFormValid($action, $entity, $form, $request); - $em = $this->getDoctrine()->getManager(); + $em = $this->getManagerRegistry()->getManager(); $this->onPreFlush($action, $entity, $form, $request); $em->flush(); @@ -603,7 +623,7 @@ class CRUDController extends AbstractController */ protected function getEntity(mixed $action, $id, Request $request): ?object { - return $this->getDoctrine() + return $this->getManagerRegistry() ->getRepository($this->getEntityClass()) ->find($id); } @@ -652,6 +672,11 @@ class CRUDController extends AbstractController return $this->container->get('chill_main.paginator_factory'); } + protected function getManagerRegistry(): ManagerRegistry + { + return $this->container->get(ManagerRegistry::class); + } + /** * Get the result of the query. */ @@ -843,9 +868,7 @@ 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 { @@ -857,58 +880,36 @@ 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. @@ -945,7 +946,7 @@ class CRUDController extends AbstractController protected function removeEntity(string $action, $entity, FormInterface $form, Request $request) { - $this->getDoctrine() + $this->getManagerRegistry() ->getManager() ->remove($entity); } diff --git a/src/Bundle/ChillMainBundle/CRUD/Exception/InvalidCrudConfiguration.php b/src/Bundle/ChillMainBundle/CRUD/Exception/InvalidCrudConfiguration.php new file mode 100644 index 000000000..350eced43 --- /dev/null +++ b/src/Bundle/ChillMainBundle/CRUD/Exception/InvalidCrudConfiguration.php @@ -0,0 +1,25 @@ + $controller.':'.($action['controller_action'] ?? $controllerAction), + '_controller' => $controller.'::'.($action['controller_action'] ?? $controllerAction), ]; // path are rewritten diff --git a/src/Bundle/ChillMainBundle/ChillMainBundle.php b/src/Bundle/ChillMainBundle/ChillMainBundle.php index b7cf4e289..ff721784a 100644 --- a/src/Bundle/ChillMainBundle/ChillMainBundle.php +++ b/src/Bundle/ChillMainBundle/ChillMainBundle.php @@ -22,7 +22,6 @@ use Chill\MainBundle\DependencyInjection\CompilerPass\ShortMessageCompilerPass; use Chill\MainBundle\DependencyInjection\CompilerPass\TimelineCompilerClass; use Chill\MainBundle\DependencyInjection\CompilerPass\WidgetsCompilerPass; use Chill\MainBundle\DependencyInjection\ConfigConsistencyCompilerPass; -use Chill\MainBundle\DependencyInjection\RoleProvidersCompilerPass; use Chill\MainBundle\Notification\NotificationHandlerInterface; use Chill\MainBundle\Routing\LocalMenuBuilderInterface; use Chill\MainBundle\Search\SearchApiInterface; @@ -44,8 +43,6 @@ class ChillMainBundle extends Bundle $container->registerForAutoconfiguration(LocalMenuBuilderInterface::class) ->addTag('chill.menu_builder'); - $container->registerForAutoconfiguration(ProvideRoleInterface::class) - ->addTag('chill.role'); $container->registerForAutoconfiguration(CenterResolverInterface::class) ->addTag('chill_main.center_resolver'); $container->registerForAutoconfiguration(ScopeResolverInterface::class) @@ -64,11 +61,12 @@ class ChillMainBundle extends Bundle ->addTag('chill_main.cron_job'); $container->registerForAutoconfiguration(ViewEntityInfoProviderInterface::class) ->addTag('chill_main.entity_info_provider'); + $container->registerForAutoconfiguration(ProvideRoleInterface::class) + ->addTag('chill_main.provide_role'); $container->addCompilerPass(new SearchableServicesCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0); $container->addCompilerPass(new ConfigConsistencyCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0); $container->addCompilerPass(new TimelineCompilerClass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0); - $container->addCompilerPass(new RoleProvidersCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0); $container->addCompilerPass(new ExportsCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0); $container->addCompilerPass(new WidgetsCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0); $container->addCompilerPass(new NotificationCounterCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0); diff --git a/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php b/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php index cb984c100..44a86cb24 100644 --- a/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php @@ -27,12 +27,12 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ChoiceQuestion; use Symfony\Component\Console\Question\ConfirmationQuestion; -use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Symfony\Component\Validator\ConstraintViolationListInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; class ChillImportUsersCommand extends Command { + protected static $defaultDescription = 'Import users from csv file'; /** * Centers and aliases. * @@ -55,7 +55,7 @@ class ChillImportUsersCommand extends Command public function __construct( protected EntityManagerInterface $em, protected LoggerInterface $logger, - protected UserPasswordEncoderInterface $passwordEncoder, + protected \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder, protected ValidatorInterface $validator, protected UserRepository $userRepository, ) { @@ -86,7 +86,6 @@ class ChillImportUsersCommand extends Command protected function configure() { $this - ->setDescription('Import users from csv file') ->setHelp("Import users from a csv file. Users are added to centers contained in the file. Headers are used to detect columns. Adding to multiple centers can be done by using a `grouping centers` file, which will group multiple centers into a signle alias, used in 'centers' column.") ->addArgument('csvfile', InputArgument::REQUIRED, 'Path to the csv file. Columns are: `username`, `email`, `center` (can contain alias), `permission group`') ->addOption('grouping-centers', null, InputOption::VALUE_OPTIONAL, 'Path to a csv file to aggregate multiple centers into a single alias') @@ -130,7 +129,7 @@ class ChillImportUsersCommand extends Command ->setEmail(\trim((string) $data['email'])) ->setUsername(\trim((string) $data['username'])) ->setEnabled(true) - ->setPassword($this->passwordEncoder->encodePassword( + ->setPassword($this->passwordEncoder->hashPassword( $user, \bin2hex(\random_bytes(32)) )); @@ -207,7 +206,7 @@ class ChillImportUsersCommand extends Command throw $e; } - return 0; + return Command::SUCCESS; } /** diff --git a/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php b/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php index b6aa1596f..c4d835dbd 100644 --- a/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php @@ -29,6 +29,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; */ class ChillUserSendRenewPasswordCodeCommand extends Command { + protected static $defaultDescription = 'Send a message with code to recover password'; /** * @var EntityManagerInterface */ @@ -82,7 +83,6 @@ class ChillUserSendRenewPasswordCodeCommand extends Command { $this ->setName('chill:user:send-password-recover-code') - ->setDescription('Send a message with code to recover password') ->addArgument('csvfile', InputArgument::REQUIRED, 'CSV file with the list of users') ->addOption('template', null, InputOption::VALUE_REQUIRED, 'Template for email') ->addOption('expiration', null, InputOption::VALUE_REQUIRED, 'Expiration of the link, as an unix timestamp') @@ -108,7 +108,7 @@ class ChillUserSendRenewPasswordCodeCommand extends Command $this->sendRecoverCode($user); } - return 0; + return Command::SUCCESS; } /** diff --git a/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php b/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php index c3b5919d7..1dc56314b 100644 --- a/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php +++ b/src/Bundle/ChillMainBundle/Command/ExecuteCronJobCommand.php @@ -19,6 +19,8 @@ use Symfony\Component\Console\Output\OutputInterface; class ExecuteCronJobCommand extends Command { + protected static $defaultDescription = 'Execute the cronjob(s) given as argument, or one cronjob scheduled by system.'; + public function __construct( private readonly CronManagerInterface $cronManager, ) { @@ -28,7 +30,6 @@ class ExecuteCronJobCommand extends Command protected function configure() { $this - ->setDescription('Execute the cronjob(s) given as argument, or one cronjob scheduled by system.') ->setHelp("If no job is specified, the next available cronjob will be executed by system.\nThis command should be execute every 15 minutes (more or less)") ->addArgument('job', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'one or more job to force execute (by default, all jobs are executed)', []) ->addUsage(''); @@ -39,13 +40,13 @@ class ExecuteCronJobCommand extends Command if ([] === $input->getArgument('job')) { $this->cronManager->run(); - return 0; + return Command::SUCCESS; } foreach ($input->getArgument('job') as $jobName) { $this->cronManager->run($jobName); } - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillMainBundle/Command/LoadAddressesBEFromBestAddressCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAddressesBEFromBestAddressCommand.php index cbcba6ea4..dfe485f04 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAddressesBEFromBestAddressCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAddressesBEFromBestAddressCommand.php @@ -20,6 +20,8 @@ use Symfony\Component\Console\Output\OutputInterface; class LoadAddressesBEFromBestAddressCommand extends Command { + protected static $defaultDescription = 'Import BE addresses from BeST Address (see https://osoc19.github.io/best/)'; + public function __construct( private readonly AddressReferenceBEFromBestAddress $addressImporter, private readonly PostalCodeBEFromBestAddress $postalCodeBEFromBestAddressImporter, @@ -32,8 +34,7 @@ class LoadAddressesBEFromBestAddressCommand extends Command $this ->setName('chill:main:address-ref-from-best-addresses') ->addArgument('lang', InputArgument::REQUIRED, "Language code, for example 'fr'") - ->addArgument('list', InputArgument::IS_ARRAY, "The list to add, for example 'full', or 'extract' (dev) or '1xxx' (brussel CP)") - ->setDescription('Import BE addresses from BeST Address (see https://osoc19.github.io/best/)'); + ->addArgument('list', InputArgument::IS_ARRAY, "The list to add, for example 'full', or 'extract' (dev) or '1xxx' (brussel CP)"); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -42,6 +43,6 @@ class LoadAddressesBEFromBestAddressCommand extends Command $this->addressImporter->import($input->getArgument('lang'), $input->getArgument('list')); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillMainBundle/Command/LoadAddressesFRFromBANOCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAddressesFRFromBANOCommand.php index 89a159fc4..2bfc3be5c 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAddressesFRFromBANOCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAddressesFRFromBANOCommand.php @@ -19,6 +19,8 @@ use Symfony\Component\Console\Output\OutputInterface; class LoadAddressesFRFromBANOCommand extends Command { + protected static $defaultDescription = 'Import FR addresses from bano (see https://bano.openstreetmap.fr'; + public function __construct(private readonly AddressReferenceFromBano $addressReferenceFromBano) { parent::__construct(); @@ -27,8 +29,7 @@ class LoadAddressesFRFromBANOCommand extends Command protected function configure() { $this->setName('chill:main:address-ref-from-bano') - ->addArgument('departementNo', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'a list of departement numbers') - ->setDescription('Import FR addresses from bano (see https://bano.openstreetmap.fr'); + ->addArgument('departementNo', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'a list of departement numbers'); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -39,6 +40,6 @@ class LoadAddressesFRFromBANOCommand extends Command $this->addressReferenceFromBano->import($departementNo); } - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillMainBundle/Command/LoadAddressesLUFromBDAddressCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAddressesLUFromBDAddressCommand.php index 499751c7c..2477a486d 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAddressesLUFromBDAddressCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAddressesLUFromBDAddressCommand.php @@ -35,6 +35,6 @@ class LoadAddressesLUFromBDAddressCommand extends Command { $this->addressImporter->import(); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php index e4b3ae673..376df4e52 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php @@ -54,8 +54,6 @@ class LoadAndUpdateLanguagesCommand extends Command { $this ->setName('chill:main:languages:populate') - ->setDescription('Load or update languages in db. This command does not delete existing '. - 'languages, but will update names according to available languages') ->addOption( self::INCLUDE_REGIONAL_VERSION, null, @@ -122,6 +120,6 @@ class LoadAndUpdateLanguagesCommand extends Command $em->flush(); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php index b6a9be75c..3f7f82523 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php @@ -55,9 +55,7 @@ class LoadCountriesCommand extends Command */ protected function configure() { - $this->setName('chill:main:countries:populate') - ->setDescription('Load or update countries in db. This command does not delete existing countries, '. - 'but will update names according to available languages'); + $this->setName('chill:main:countries:populate'); } /** @@ -83,6 +81,6 @@ class LoadCountriesCommand extends Command $em->flush(); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodeFR.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodeFR.php index be29cad9f..eb0bef879 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodeFR.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodeFR.php @@ -18,6 +18,8 @@ use Symfony\Component\Console\Output\OutputInterface; class LoadPostalCodeFR extends Command { + protected static $defaultDescription = 'Load France\'s postal code from online open data'; + public function __construct(private readonly PostalCodeFRFromOpenData $loader) { parent::__construct(); @@ -25,14 +27,13 @@ class LoadPostalCodeFR extends Command public function configure(): void { - $this->setName('chill:main:postal-code:load:FR') - ->setDescription('Load France\'s postal code from online open data'); + $this->setName('chill:main:postal-code:load:FR'); } public function execute(InputInterface $input, OutputInterface $output): int { $this->loader->import(); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php index fe11f8b9f..4f0896114 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php @@ -25,6 +25,8 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; class LoadPostalCodesCommand extends Command { + protected static $defaultDescription = 'Add the postal code from a csv file.'; + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly ValidatorInterface $validator) { parent::__construct(); @@ -33,7 +35,6 @@ class LoadPostalCodesCommand extends Command protected function configure() { $this->setName('chill:main:postal-code:populate') - ->setDescription('Add the postal code from a csv file.') ->setHelp('This script will try to avoid existing postal code ' ."using the postal code and name. \n" .'The CSV file must have the following columns: ' @@ -101,7 +102,7 @@ class LoadPostalCodesCommand extends Command $output->writeln(''.$num.' were added !'); - return 0; + return Command::SUCCESS; } private function addPostalCode($row, OutputInterface $output) @@ -194,14 +195,8 @@ 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 a83663ed0..6924b8049 100644 --- a/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php +++ b/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php @@ -18,13 +18,14 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Security\Core\Encoder\EncoderFactory; -use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder; /** * Class SetPasswordCommand. */ class SetPasswordCommand extends Command { + protected static $defaultDescription = 'set a password to user'; + /** * SetPasswordCommand constructor. */ @@ -42,7 +43,7 @@ class SetPasswordCommand extends Command public function _setPassword(User $user, $password) { - $defaultEncoder = new MessageDigestPasswordEncoder('sha512', true, 5000); + $defaultEncoder = new \Symfony\Component\PasswordHasher\Hasher\MessageDigestPasswordHasher('sha512', true, 5000); $encoders = [ User::class => $defaultEncoder, ]; @@ -56,7 +57,6 @@ class SetPasswordCommand extends Command public function configure() { $this->setName('chill:user:set_password') - ->setDescription('set a password to user') ->addArgument('username', InputArgument::REQUIRED, 'the user\'s ' .'username you want to change password') ->addArgument('password', InputArgument::OPTIONAL, 'the new password'); @@ -80,6 +80,6 @@ class SetPasswordCommand extends Command $this->_setPassword($user, $password); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillMainBundle/Command/SynchronizeEntityInfoViewsCommand.php b/src/Bundle/ChillMainBundle/Command/SynchronizeEntityInfoViewsCommand.php index 71bee0e0e..16a90dbe8 100644 --- a/src/Bundle/ChillMainBundle/Command/SynchronizeEntityInfoViewsCommand.php +++ b/src/Bundle/ChillMainBundle/Command/SynchronizeEntityInfoViewsCommand.php @@ -18,22 +18,20 @@ use Symfony\Component\Console\Output\OutputInterface; class SynchronizeEntityInfoViewsCommand extends Command { + protected static $defaultDescription = 'Update or create sql views which provide info for various entities'; + public function __construct( private readonly ViewEntityInfoManager $viewEntityInfoManager, ) { parent::__construct('chill:db:sync-views'); } - protected function configure(): void - { - $this - ->setDescription('Update or create sql views which provide info for various entities'); - } + protected function configure(): void {} protected function execute(InputInterface $input, OutputInterface $output): int { $this->viewEntityInfoManager->synchronizeOnDB(); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillMainBundle/Controller/AbsenceController.php b/src/Bundle/ChillMainBundle/Controller/AbsenceController.php index 809b7b901..3961c9f3a 100644 --- a/src/Bundle/ChillMainBundle/Controller/AbsenceController.php +++ b/src/Bundle/ChillMainBundle/Controller/AbsenceController.php @@ -12,28 +12,25 @@ declare(strict_types=1); namespace Chill\MainBundle\Controller; use Chill\MainBundle\Form\AbsenceType; +use Chill\MainBundle\Security\ChillSecurity; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; class AbsenceController extends AbstractController { - /** - * @Route( - * "/{_locale}/absence", - * name="chill_main_user_absence_index", - * methods={"GET", "POST"} - * ) - */ + public function __construct(private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} + + #[Route(path: '/{_locale}/absence', name: 'chill_main_user_absence_index', methods: ['GET', 'POST'])] public function setAbsence(Request $request) { - $user = $this->getUser(); + $user = $this->security->getUser(); $form = $this->createForm(AbsenceType::class, $user); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - $em = $this->getDoctrine()->getManager(); + $em = $this->managerRegistry->getManager(); $em->flush(); return $this->redirectToRoute('chill_main_user_absence_index'); @@ -45,19 +42,13 @@ class AbsenceController extends AbstractController ]); } - /** - * @Route( - * "/{_locale}/absence/unset", - * name="chill_main_user_absence_unset", - * methods={"GET", "POST"} - * ) - */ + #[Route(path: '/{_locale}/absence/unset', name: 'chill_main_user_absence_unset', methods: ['GET', 'POST'])] public function unsetAbsence(Request $request) { - $user = $this->getUser(); + $user = $this->security->getUser(); $user->setAbsenceStart(null); - $em = $this->getDoctrine()->getManager(); + $em = $this->managerRegistry->getManager(); $em->flush(); return $this->redirectToRoute('chill_main_user_absence_index'); diff --git a/src/Bundle/ChillMainBundle/Controller/AddressApiController.php b/src/Bundle/ChillMainBundle/Controller/AddressApiController.php index 6bc952923..5ea68cdbc 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressApiController.php @@ -20,18 +20,18 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; class AddressApiController extends ApiController { + public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} + /** * Duplicate an existing address. - * - * @Route("/api/1.0/main/address/{id}/duplicate.json", name="chill_api_main_address_duplicate", - * methods={"POST"}) */ + #[Route(path: '/api/1.0/main/address/{id}/duplicate.json', name: 'chill_api_main_address_duplicate', methods: ['POST'])] public function duplicate(Address $address): JsonResponse { $this->denyAccessUnlessGranted('ROLE_USER'); $new = Address::createFromAddress($address); - $em = $this->getDoctrine()->getManager(); + $em = $this->managerRegistry->getManager(); $em->persist($new); $em->flush(); diff --git a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php index edc58bed5..e50cea6bb 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php @@ -26,13 +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") - */ + #[Route(path: '/api/1.0/main/address-reference/by-postal-code/{id}/search.json')] public function search(PostalCode $postalCode, Request $request): JsonResponse { $this->denyAccessUnlessGranted('ROLE_USER'); diff --git a/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php b/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php index 079f4783b..680a63859 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php @@ -23,13 +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"}) - */ + #[Route(path: '/api/1.0/main/address/reference-match/{id}/set/reviewed', methods: ['POST'])] public function markAddressAsReviewed(Address $address): JsonResponse { if (!$this->security->isGranted('ROLE_USER')) { @@ -50,9 +46,8 @@ class AddressToReferenceMatcherController /** * Set an address back to "to review". Only if the address is in "reviewed" state. - * - * @Route("/api/1.0/main/address/reference-match/{id}/set/to_review", methods={"POST"}) */ + #[Route(path: '/api/1.0/main/address/reference-match/{id}/set/to_review', methods: ['POST'])] public function markAddressAsToReview(Address $address): JsonResponse { if (!$this->security->isGranted('ROLE_USER')) { @@ -75,9 +70,7 @@ class AddressToReferenceMatcherController ); } - /** - * @Route("/api/1.0/main/address/reference-match/{id}/sync-with-reference", methods={"POST"}) - */ + #[Route(path: '/api/1.0/main/address/reference-match/{id}/sync-with-reference', methods: ['POST'])] public function syncAddressWithReference(Address $address): JsonResponse { if (null === $address->getAddressReference()) { diff --git a/src/Bundle/ChillMainBundle/Controller/AdminController.php b/src/Bundle/ChillMainBundle/Controller/AdminController.php index 46fbfb351..abdfb679d 100644 --- a/src/Bundle/ChillMainBundle/Controller/AdminController.php +++ b/src/Bundle/ChillMainBundle/Controller/AdminController.php @@ -16,41 +16,31 @@ use Symfony\Component\Routing\Annotation\Route; class AdminController extends AbstractController { - /** - * @Route("/{_locale}/admin", name="chill_main_admin_central") - */ + #[Route(path: '/{_locale}/admin', name: 'chill_main_admin_central')] public function indexAction() { return $this->render('@ChillMain/Admin/index.html.twig'); } - /** - * @Route("/{_locale}/admin/language", name="chill_main_language_admin") - */ + #[Route(path: '/{_locale}/admin/language', name: 'chill_main_language_admin')] public function indexLanguageAction() { return $this->render('@ChillMain/Admin/indexLanguage.html.twig'); } - /** - * @Route("/{_locale}/admin/location", name="chill_main_location_admin") - */ + #[Route(path: '/{_locale}/admin/location', name: 'chill_main_location_admin')] public function indexLocationAction() { return $this->render('@ChillMain/Admin/indexLocation.html.twig'); } - /** - * @Route("/{_locale}/admin/user", name="chill_main_user_admin") - */ + #[Route(path: '/{_locale}/admin/user', name: 'chill_main_user_admin')] public function indexUserAction() { return $this->render('@ChillMain/Admin/indexUser.html.twig'); } - /** - * @Route("/{_locale}/admin/dashboard", name="chill_main_dashboard_admin") - */ + #[Route(path: '/{_locale}/admin/dashboard', name: 'chill_main_dashboard_admin')] public function indexDashboardAction() { return $this->render('@ChillMain/Admin/indexDashboard.html.twig'); diff --git a/src/Bundle/ChillMainBundle/Controller/CountryApiController.php b/src/Bundle/ChillMainBundle/Controller/CountryApiController.php new file mode 100644 index 000000000..12e5258fd --- /dev/null +++ b/src/Bundle/ChillMainBundle/Controller/CountryApiController.php @@ -0,0 +1,16 @@ +isGranted('ROLE_ADMIN')) { @@ -30,9 +28,7 @@ class DefaultController extends AbstractController return $this->render('@ChillMain/layout.html.twig'); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/homepage", name="chill_main_homepage_without_locale") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/homepage', name: 'chill_main_homepage_without_locale')] public function indexWithoutLocaleAction() { return $this->redirectToRoute('chill_main_homepage'); diff --git a/src/Bundle/ChillMainBundle/Controller/ExportController.php b/src/Bundle/ChillMainBundle/Controller/ExportController.php index 2df7008d6..08b89e4bb 100644 --- a/src/Bundle/ChillMainBundle/Controller/ExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/ExportController.php @@ -65,9 +65,7 @@ class ExportController extends AbstractController $this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center']; } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/download/{alias}", name="chill_main_export_download", methods={"GET"}) - */ + #[Route(path: '/{_locale}/exports/download/{alias}', name: 'chill_main_export_download', methods: ['GET'])] public function downloadResultAction(Request $request, mixed $alias) { /** @var ExportManager $exportManager */ @@ -107,12 +105,9 @@ class ExportController extends AbstractController * This action must work with GET queries. * * @param string $alias - * - * @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) + #[Route(path: '/{_locale}/exports/generate/{alias}', name: 'chill_main_export_generate', methods: ['GET'])] + public function generateAction(Request $request, $alias): Response { /** @var ExportManager $exportManager */ $exportManager = $this->exportManager; @@ -130,10 +125,9 @@ class ExportController extends AbstractController } /** - * @Route("/{_locale}/exports/generate-from-saved/{id}", name="chill_main_export_generate_from_saved") - * * @throws \RedisException */ + #[Route(path: '/{_locale}/exports/generate-from-saved/{id}', name: 'chill_main_export_generate_from_saved')] public function generateFromSavedExport(SavedExport $savedExport): RedirectResponse { $this->denyAccessUnlessGranted(SavedExportVoter::GENERATE, $savedExport); @@ -154,9 +148,8 @@ class ExportController extends AbstractController /** * Render the list of available exports. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/", name="chill_main_export_index") */ + #[Route(path: '/{_locale}/exports/', name: 'chill_main_export_index')] public function indexAction(): Response { $exportManager = $this->exportManager; @@ -179,9 +172,8 @@ class ExportController extends AbstractController * stored in the session (if valid), and then a redirection is done to next step. * 3. 'generate': gather data from session from the previous steps, and * make a redirection to the "generate" action with data in query (HTTP GET) - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/new/{alias}", name="chill_main_export_new") */ + #[Route(path: '/{_locale}/exports/new/{alias}', name: 'chill_main_export_new')] public function newAction(Request $request, string $alias): Response { // first check for ACL @@ -205,9 +197,7 @@ class ExportController extends AbstractController }; } - /** - * @Route("/{_locale}/export/saved/update-from-key/{id}/{key}", name="chill_main_export_saved_edit_options_from_key") - */ + #[Route(path: '/{_locale}/export/saved/update-from-key/{id}/{key}', name: 'chill_main_export_saved_edit_options_from_key')] public function editSavedExportOptionsFromKey(SavedExport $savedExport, string $key): Response { $this->denyAccessUnlessGranted('ROLE_USER'); @@ -227,9 +217,7 @@ class ExportController extends AbstractController return $this->redirectToRoute('chill_main_export_saved_edit', ['id' => $savedExport->getId()]); } - /** - * @Route("/{_locale}/export/save-from-key/{alias}/{key}", name="chill_main_export_save_from_key") - */ + #[Route(path: '/{_locale}/export/save-from-key/{alias}/{key}', name: 'chill_main_export_save_from_key')] public function saveFromKey(string $alias, string $key, Request $request): Response { $this->denyAccessUnlessGranted('ROLE_USER'); @@ -300,7 +288,7 @@ class ExportController extends AbstractController $builder = $this->formFactory ->createNamedBuilder( - null, + '', FormType::class, $defaultFormData, [ @@ -644,7 +632,7 @@ class ExportController extends AbstractController } } - private function rebuildRawData(string $key): array + private function rebuildRawData(?string $key): array { if (null === $key) { throw $this->createNotFoundException('key does not exists'); diff --git a/src/Bundle/ChillMainBundle/Controller/GeographicalUnitApiController.php b/src/Bundle/ChillMainBundle/Controller/GeographicalUnitApiController.php new file mode 100644 index 000000000..19a1da160 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Controller/GeographicalUnitApiController.php @@ -0,0 +1,16 @@ + 'json'])] public function getGeographicalUnitCoveringAddress(Address $address): JsonResponse { if (!$this->security->isGranted('ROLE_USER')) { diff --git a/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php b/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php index bc28f9d12..418f49578 100644 --- a/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php +++ b/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php @@ -13,6 +13,4 @@ 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 e04f478a8..ca4717728 100644 --- a/src/Bundle/ChillMainBundle/Controller/LoginController.php +++ b/src/Bundle/ChillMainBundle/Controller/LoginController.php @@ -33,12 +33,9 @@ class LoginController extends AbstractController /** * Show a login form. - * - * @return Response - * - * @\Symfony\Component\Routing\Annotation\Route(path="/login", name="login") */ - public function loginAction(Request $request) + #[\Symfony\Component\Routing\Annotation\Route(path: '/login', name: 'login')] + public function loginAction(Request $request): Response { return $this->render('@ChillMain/Login/login.html.twig', [ 'last_username' => $this->helper->getLastUsername(), @@ -46,7 +43,5 @@ class LoginController extends AbstractController ]); } - public function LoginCheckAction(Request $request) - { - } + public function LoginCheckAction(Request $request) {} } diff --git a/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php b/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php index b40d3bc95..e122b7a3b 100644 --- a/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php @@ -25,14 +25,12 @@ class NewsItemApiController private readonly NewsItemRepository $newsItemRepository, private readonly SerializerInterface $serializer, private readonly PaginatorFactory $paginatorFactory, - ) { - } + ) {} /** * Get list of news items filtered on start and end date. - * - * @Route("/api/1.0/main/news/current.json", methods={"get"}) */ + #[Route(path: '/api/1.0/main/news/current.json', methods: ['get'])] public function listCurrentNewsItems(): JsonResponse { $total = $this->newsItemRepository->countCurrentNews(); diff --git a/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php b/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php index cf1f4922b..78b7077ee 100644 --- a/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php +++ b/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php @@ -28,12 +28,9 @@ final readonly class NewsItemHistoryController private readonly PaginatorFactory $paginatorFactory, private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory, private readonly Environment $environment, - ) { - } + ) {} - /** - * @Route("/{_locale}/news-items/history", name="chill_main_news_items_history") - */ + #[Route(path: '/{_locale}/news-items/history', name: 'chill_main_news_items_history')] public function list(): Response { $filter = $this->buildFilterOrder(); @@ -49,9 +46,7 @@ final readonly class NewsItemHistoryController ])); } - /** - * @Route("/{_locale}/news-items/{id}", name="chill_main_single_news_item") - */ + #[Route(path: '/{_locale}/news-items/{id}', name: 'chill_main_single_news_item')] public function showSingleItem(NewsItem $newsItem, Request $request): Response { return new Response($this->environment->render( diff --git a/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php b/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php index 61459f4d8..1c086cdf2 100644 --- a/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php @@ -26,34 +26,24 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Security; use Symfony\Component\Serializer\SerializerInterface; -/** - * @Route("/api/1.0/main/notification") - */ +#[Route(path: '/api/1.0/main/notification')] 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"}) - */ + #[Route(path: '/{id}/mark/read', name: 'chill_api_main_notification_mark_read', methods: ['POST'])] public function markAsRead(Notification $notification): JsonResponse { return $this->markAs('read', $notification); } - /** - * @Route("/{id}/mark/unread", name="chill_api_main_notification_mark_unread", methods={"POST"}) - */ + #[Route(path: '/{id}/mark/unread', name: 'chill_api_main_notification_mark_unread', methods: ['POST'])] public function markAsUnread(Notification $notification): JsonResponse { return $this->markAs('unread', $notification); } - /** - * @Route("/my/unread") - */ + #[Route(path: '/my/unread')] public function myUnreadNotifications(Request $request): JsonResponse { $total = $this->notificationRepository->countUnreadByUser($this->security->getUser()); diff --git a/src/Bundle/ChillMainBundle/Controller/NotificationController.php b/src/Bundle/ChillMainBundle/Controller/NotificationController.php index f9ae1be02..7ca6a3465 100644 --- a/src/Bundle/ChillMainBundle/Controller/NotificationController.php +++ b/src/Bundle/ChillMainBundle/Controller/NotificationController.php @@ -13,7 +13,6 @@ namespace Chill\MainBundle\Controller; use Chill\MainBundle\Entity\Notification; use Chill\MainBundle\Entity\NotificationComment; -use Chill\MainBundle\Entity\User; use Chill\MainBundle\Form\NotificationCommentType; use Chill\MainBundle\Form\NotificationType; use Chill\MainBundle\Notification\Exception\NotificationHandlerNotFound; @@ -22,6 +21,7 @@ use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Repository\NotificationRepository; use Chill\MainBundle\Repository\UserRepository; use Chill\MainBundle\Security\Authorization\NotificationVoter; +use Chill\MainBundle\Security\ChillSecurity; use Doctrine\ORM\EntityManagerInterface; use Psr\Log\LoggerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -32,30 +32,19 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\Security\Core\Security; use Symfony\Contracts\Translation\TranslatorInterface; use function in_array; -/** - * @Route("/{_locale}/notification") - */ +#[Route(path: '/{_locale}/notification')] 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 ChillSecurity $security, private readonly NotificationRepository $notificationRepository, private readonly NotificationHandlerManager $notificationHandlerManager, private readonly PaginatorFactory $paginatorFactory, private readonly TranslatorInterface $translator, private readonly UserRepository $userRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} - /** - * @Route("/create", name="chill_main_notification_create") - */ + #[Route(path: '/create', name: 'chill_main_notification_create')] public function createAction(Request $request): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); - if (!$this->security->getUser() instanceof User) { - throw new AccessDeniedHttpException('You must be authenticated and a user to create a notification'); - } - if (!$request->query->has('entityClass')) { throw new BadRequestHttpException('Missing entityClass parameter'); } @@ -70,13 +59,13 @@ class NotificationController extends AbstractController ->setRelatedEntityId($request->query->getInt('entityId')) ->setSender($this->security->getUser()); - if ($request->query->has('tos')) { - foreach ($request->query->get('tos') as $toId) { - if (null === $to = $this->userRepository->find($toId)) { - throw new NotFoundHttpException("user with id {$toId} is not found"); - } - $notification->addAddressee($to); + $tos = $request->query->all('tos'); + + foreach ($tos as $toId) { + if (null === $to = $this->userRepository->find($toId)) { + throw new NotFoundHttpException("user with id {$toId} is not found"); } + $notification->addAddressee($to); } try { @@ -109,9 +98,7 @@ class NotificationController extends AbstractController ]); } - /** - * @Route("/{id}/edit", name="chill_main_notification_edit") - */ + #[Route(path: '/{id}/edit', name: 'chill_main_notification_edit')] public function editAction(Notification $notification, Request $request): Response { $this->denyAccessUnlessGranted(NotificationVoter::NOTIFICATION_UPDATE, $notification); @@ -139,17 +126,11 @@ class NotificationController extends AbstractController ]); } - /** - * @Route("/{id}/access_key", name="chill_main_notification_grant_access_by_access_key") - */ + #[Route(path: '/{id}/access_key', name: 'chill_main_notification_grant_access_by_access_key')] public function getAccessByAccessKey(Notification $notification, Request $request): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); - if (!$this->security->getUser() instanceof User) { - throw new AccessDeniedHttpException('You must be authenticated and a user to create a notification'); - } - foreach (['accessKey'/* , 'email' */] as $param) { if (!$request->query->has($param)) { throw new BadRequestHttpException("Missing {$param} parameter"); @@ -170,7 +151,7 @@ class NotificationController extends AbstractController $notification->addAddressee($this->security->getUser()); - $this->getDoctrine()->getManager()->flush(); + $this->managerRegistry->getManager()->flush(); $logMsg = '[Notification] a user is granted access to notification trough an access key'; $context = [ @@ -185,18 +166,12 @@ class NotificationController extends AbstractController return $this->redirectToRoute('chill_main_notification_show', ['id' => $notification->getId()]); } - /** - * @Route("/inbox", name="chill_main_notification_my") - */ + #[Route(path: '/inbox', name: 'chill_main_notification_my')] public function inboxAction(): Response { - $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); + $this->denyAccessUnlessGranted('ROLE_USER'); $currentUser = $this->security->getUser(); - if (!$currentUser instanceof User) { - throw new AccessDeniedHttpException('Only regular user should access this page'); - } - $notificationsNbr = $this->notificationRepository->countAllForAttendee($currentUser); $paginator = $this->paginatorFactory->create($notificationsNbr); @@ -215,9 +190,7 @@ class NotificationController extends AbstractController ]); } - /** - * @Route("/sent", name="chill_main_notification_sent") - */ + #[Route(path: '/sent', name: 'chill_main_notification_sent')] public function sentAction(): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); @@ -241,9 +214,7 @@ class NotificationController extends AbstractController ]); } - /** - * @Route("/{id}/show", name="chill_main_notification_show") - */ + #[Route(path: '/{id}/show', name: 'chill_main_notification_show')] public function showAction(Notification $notification, Request $request): Response { $this->denyAccessUnlessGranted(NotificationVoter::NOTIFICATION_SEE, $notification); @@ -314,8 +285,8 @@ class NotificationController extends AbstractController ]); // we mark the notification as read after having computed the response - if ($this->getUser() instanceof User && !$notification->isReadBy($this->getUser())) { - $notification->markAsReadBy($this->getUser()); + if (!$notification->isReadBy($this->security->getUser())) { + $notification->markAsReadBy($this->security->getUser()); $this->em->flush(); } diff --git a/src/Bundle/ChillMainBundle/Controller/PasswordController.php b/src/Bundle/ChillMainBundle/Controller/PasswordController.php index 8d9bf9c74..958f66fd1 100644 --- a/src/Bundle/ChillMainBundle/Controller/PasswordController.php +++ b/src/Bundle/ChillMainBundle/Controller/PasswordController.php @@ -13,6 +13,7 @@ namespace Chill\MainBundle\Controller; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Form\UserPasswordType; +use Chill\MainBundle\Security\ChillSecurity; use Chill\MainBundle\Security\PasswordRecover\PasswordRecoverEvent; use Chill\MainBundle\Security\PasswordRecover\PasswordRecoverVoter; use Chill\MainBundle\Security\PasswordRecover\RecoverPasswordHelper; @@ -24,8 +25,8 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Symfony\Component\Validator\Constraints\Callback; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -33,70 +34,23 @@ use Symfony\Contracts\Translation\TranslatorInterface; /** * Class PasswordController. */ -class PasswordController extends AbstractController +final class PasswordController extends AbstractController { - /** - * @var LoggerInterface - */ - protected $chillLogger; - - /** - * @var EventDispatcherInterface - */ - protected $eventDispatcher; - - /** - * @var UserPasswordEncoderInterface - */ - protected $passwordEncoder; - - /** - * @var RecoverPasswordHelper - */ - protected $recoverPasswordHelper; - - /** - * @var TokenManager - */ - protected $tokenManager; - - /** - * @var TranslatorInterface - */ - protected $translator; - /** * PasswordController constructor. */ - public function __construct( - LoggerInterface $chillLogger, - UserPasswordEncoderInterface $passwordEncoder, - RecoverPasswordHelper $recoverPasswordHelper, - TokenManager $tokenManager, - TranslatorInterface $translator, - EventDispatcherInterface $eventDispatcher, - ) { - $this->chillLogger = $chillLogger; - $this->passwordEncoder = $passwordEncoder; - $this->translator = $translator; - $this->tokenManager = $tokenManager; - $this->recoverPasswordHelper = $recoverPasswordHelper; - $this->eventDispatcher = $eventDispatcher; - } + public function __construct(private readonly LoggerInterface $chillLogger, private readonly \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder, private readonly RecoverPasswordHelper $recoverPasswordHelper, private readonly TokenManager $tokenManager, private readonly TranslatorInterface $translator, private readonly EventDispatcherInterface $eventDispatcher, private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} /** * @return Response - * - * @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-changed", name="password_request_recover_changed") */ + #[Route(path: '/public/{_locale}/password/request-changed', name: 'password_request_recover_changed')] public function changeConfirmedAction() { return $this->render('@ChillMain/Password/recover_password_changed.html.twig'); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/recover", name="password_recover") - */ + #[Route(path: '/public/{_locale}/password/recover', name: 'password_recover')] public function recoverAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse { if (false === $this->isGranted(PasswordRecoverVoter::ASK_TOKEN)) { @@ -110,7 +64,7 @@ class PasswordController extends AbstractController $hash = $query->getAlnum(TokenManager::HASH); $token = $query->getAlnum(TokenManager::TOKEN); $timestamp = $query->getAlnum(TokenManager::TIMESTAMP); - $user = $this->getDoctrine()->getRepository(User::class) + $user = $this->managerRegistry->getRepository(User::class) ->findOneByUsernameCanonical($username); if (null === $user) { @@ -138,7 +92,7 @@ class PasswordController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { $password = $form->get('new_password')->getData(); - $user->setPassword($this->passwordEncoder->encodePassword($user, $password)); + $user->setPassword($this->passwordEncoder->hashPassword($user, $password)); // logging for prod $this ->chillLogger @@ -149,7 +103,7 @@ class PasswordController extends AbstractController ] ); - $this->getDoctrine()->getManager()->flush(); + $this->managerRegistry->getManager()->flush(); return $this->redirectToRoute('password_request_recover_changed'); } @@ -162,9 +116,8 @@ class PasswordController extends AbstractController /** * @throws \Doctrine\ORM\NoResultException * @throws \Doctrine\ORM\NonUniqueResultException - * - * @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-recover", name="password_request_recover") */ + #[Route(path: '/public/{_locale}/password/request-recover', name: 'password_request_recover')] public function requestRecoverAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse { if (false === $this->isGranted(PasswordRecoverVoter::ASK_TOKEN)) { @@ -179,7 +132,7 @@ class PasswordController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { /** @var \Doctrine\ORM\QueryBuilder $qb */ - $qb = $this->getDoctrine()->getManager() + $qb = $this->managerRegistry->getManager() ->createQueryBuilder(); $qb->select('u') ->from(User::class, 'u') @@ -235,9 +188,8 @@ class PasswordController extends AbstractController /** * @return Response - * - * @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-confirm", name="password_request_recover_confirm") */ + #[Route(path: '/public/{_locale}/password/request-confirm', name: 'password_request_recover_confirm')] public function requestRecoverConfirmAction() { return $this->render('@ChillMain/Password/request_recover_password_confirm.html.twig'); @@ -245,13 +197,15 @@ class PasswordController extends AbstractController /** * @return Response - * - * @Route("/{_locale}/my/password", name="change_my_password") */ + #[Route(path: '/{_locale}/my/password', name: 'change_my_password')] public function UserPasswordAction(Request $request) { + if (!$this->security->isGranted('ROLE_USER')) { + throw new AccessDeniedHttpException(); + } // get authentified user - $user = $this->getUser(); + $user = $this->security->getUser(); // create a form for password_encoder $form = $this->passwordForm($user); @@ -269,13 +223,13 @@ class PasswordController extends AbstractController 'update password for an user', [ 'method' => $request->getMethod(), - 'user' => $user->getUsername(), + 'user' => $user->getUserIdentifier(), ] ); - $user->setPassword($this->passwordEncoder->encodePassword($user, $password)); + $user->setPassword($this->passwordEncoder->hashPassword($user, $password)); - $em = $this->getDoctrine()->getManager(); + $em = $this->managerRegistry->getManager(); $em->flush(); $this->addFlash('success', $this->translator->trans('Password successfully updated!')); @@ -301,7 +255,7 @@ class PasswordController extends AbstractController 'constraints' => [ new Callback([ 'callback' => function ($pattern, ExecutionContextInterface $context, $payload) { - $qb = $this->getDoctrine()->getManager() + $qb = $this->managerRegistry->getManager() ->createQueryBuilder(); $qb->select('COUNT(u)') ->from(User::class, 'u') @@ -324,7 +278,7 @@ class PasswordController extends AbstractController } /** - * @return \Symfony\Component\Form\Form + * @return \Symfony\Component\Form\FormInterface */ private function passwordForm(User $user) { diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php b/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php index 97b255a85..2abb7333f 100644 --- a/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php @@ -21,15 +21,12 @@ 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"}) - * * @throws \Symfony\Component\Serializer\Exception\ExceptionInterface */ + #[Route(path: '/api/1.0/main/permissions/info.json', methods: ['POST'])] public function getPermissions(Request $request): JsonResponse { $this->denyAccessUnlessGranted('ROLE_USER'); diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php index 208e13875..d4ee293b1 100644 --- a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php +++ b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php @@ -47,12 +47,9 @@ 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"}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{id}/add_link_role_scope', name: 'admin_permissionsgroup_add_role_scope', methods: ['POST'])] public function addLinkRoleScopeAction(Request $request, int $id): Response { $permissionsGroup = $this->permissionsGroupRepository->find($id); @@ -64,7 +61,7 @@ final class PermissionsGroupController extends AbstractController $form = $this->createAddRoleScopeForm($permissionsGroup); $form->handleRequest($request); - if ($form->isValid()) { + if ($form->isSubmitted() && $form->isValid()) { $roleScope = $this->getPersistentRoleScopeBy( $form['composed_role_scope']->getData()->getRole(), $form['composed_role_scope']->getData()->getScope() @@ -77,7 +74,7 @@ final class PermissionsGroupController extends AbstractController $this->em->flush(); $this->addFlash( - 'notice', + 'success', $this->translator->trans('The permissions have been added') ); @@ -130,9 +127,8 @@ final class PermissionsGroupController extends AbstractController /** * Creates a new PermissionsGroup entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/create", name="admin_permissionsgroup_create", methods={"POST"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/create', name: 'admin_permissionsgroup_create', methods: ['POST'])] public function createAction(Request $request): Response { $permissionsGroup = new PermissionsGroup(); @@ -154,9 +150,8 @@ final class PermissionsGroupController extends AbstractController /** * remove an association between permissionsGroup and roleScope. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{pgid}/delete_link_role_scope/{rsid}", name="admin_permissionsgroup_delete_role_scope", methods={"DELETE"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{pgid}/delete_link_role_scope/{rsid}', name: 'admin_permissionsgroup_delete_role_scope', methods: ['POST'])] public function deleteLinkRoleScopeAction(int $pgid, int $rsid): Response { $permissionsGroup = $this->permissionsGroupRepository->find($pgid); @@ -212,9 +207,8 @@ final class PermissionsGroupController extends AbstractController /** * Displays a form to edit an existing PermissionsGroup entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/edit", name="admin_permissionsgroup_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{id}/edit', name: 'admin_permissionsgroup_edit')] public function editAction(int $id): Response { $permissionsGroup = $this->permissionsGroupRepository->find($id); @@ -260,9 +254,8 @@ final class PermissionsGroupController extends AbstractController /** * Lists all PermissionsGroup entities. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/", name="admin_permissionsgroup") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/', name: 'admin_permissionsgroup')] public function indexAction(): Response { $entities = $this->permissionsGroupRepository->findAllOrderedAlphabetically(); @@ -274,9 +267,8 @@ final class PermissionsGroupController extends AbstractController /** * Displays a form to create a new PermissionsGroup entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/new", name="admin_permissionsgroup_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/new', name: 'admin_permissionsgroup_new')] public function newAction(): Response { $permissionsGroup = new PermissionsGroup(); @@ -290,9 +282,8 @@ final class PermissionsGroupController extends AbstractController /** * Finds and displays a PermissionsGroup entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/show", name="admin_permissionsgroup_show") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{id}/show', name: 'admin_permissionsgroup_show')] public function showAction(int $id): Response { $permissionsGroup = $this->permissionsGroupRepository->find($id); @@ -343,9 +334,8 @@ final class PermissionsGroupController extends AbstractController /** * Edits an existing PermissionsGroup entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/update", name="admin_permissionsgroup_update", methods={"POST", "PUT"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{id}/update', name: 'admin_permissionsgroup_update', methods: ['POST', 'PUT'])] public function updateAction(Request $request, int $id): Response { $permissionsGroup = $this->permissionsGroupRepository @@ -426,7 +416,6 @@ final class PermissionsGroupController extends AbstractController 'admin_permissionsgroup_add_role_scope', ['id' => $permissionsGroup->getId()] )) - ->setMethod('PUT') ->add('composed_role_scope', ComposedRoleScopeType::class) ->add('submit', SubmitType::class, ['label' => 'Add permission']) ->getForm(); diff --git a/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php index e51f74e40..cd13ad455 100644 --- a/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php +++ b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php @@ -26,13 +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") - */ + #[Route(path: '/api/1.0/main/postal-code/search.json')] public function search(Request $request): JsonResponse { $this->denyAccessUnlessGranted('ROLE_USER'); diff --git a/src/Bundle/ChillMainBundle/Controller/PostalCodeController.php b/src/Bundle/ChillMainBundle/Controller/PostalCodeController.php index f186561d5..edd8efda8 100644 --- a/src/Bundle/ChillMainBundle/Controller/PostalCodeController.php +++ b/src/Bundle/ChillMainBundle/Controller/PostalCodeController.php @@ -29,18 +29,15 @@ class PostalCodeController extends AbstractController */ protected $translatableStringHelper; - public function __construct(TranslatableStringHelper $translatableStringHelper) + public function __construct(TranslatableStringHelper $translatableStringHelper, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) { $this->translatableStringHelper = $translatableStringHelper; } /** - * @Route( - * "{_locale}/postalcode/search" - * ) - * * @return JsonResponse */ + #[Route(path: '{_locale}/postalcode/search')] public function searchAction(Request $request) { $pattern = $request->query->getAlnum('q', ''); @@ -49,7 +46,7 @@ class PostalCodeController extends AbstractController return new JsonResponse(['results' => [], 'pagination' => ['more' => false]]); } - $query = $this->getDoctrine()->getManager() + $query = $this->managerRegistry->getManager() ->createQuery( sprintf( 'SELECT p.id AS id, p.name AS name, p.code AS code, ' diff --git a/src/Bundle/ChillMainBundle/Controller/SavedExportController.php b/src/Bundle/ChillMainBundle/Controller/SavedExportController.php index 0269ff0f5..82d41a9e1 100644 --- a/src/Bundle/ChillMainBundle/Controller/SavedExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/SavedExportController.php @@ -34,13 +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") - */ + #[Route(path: '/{_locale}/exports/saved/{id}/delete', name: 'chill_main_export_saved_delete')] public function delete(SavedExport $savedExport, Request $request): Response { if (!$this->security->isGranted(SavedExportVoter::DELETE, $savedExport)) { @@ -73,9 +69,7 @@ class SavedExportController ); } - /** - * @Route("/{_locale}/exports/saved/{id}/edit", name="chill_main_export_saved_edit") - */ + #[Route(path: '/{_locale}/exports/saved/{id}/edit', name: 'chill_main_export_saved_edit')] public function edit(SavedExport $savedExport, Request $request): Response { if (!$this->security->isGranted(SavedExportVoter::EDIT, $savedExport)) { @@ -106,9 +100,7 @@ class SavedExportController ); } - /** - * @Route("/{_locale}/exports/saved/my", name="chill_main_export_saved_list_my") - */ + #[Route(path: '/{_locale}/exports/saved/my', name: 'chill_main_export_saved_list_my')] public function list(): Response { $user = $this->security->getUser(); diff --git a/src/Bundle/ChillMainBundle/Controller/ScopeController.php b/src/Bundle/ChillMainBundle/Controller/ScopeController.php index 3ccf13c07..45278d7af 100644 --- a/src/Bundle/ChillMainBundle/Controller/ScopeController.php +++ b/src/Bundle/ChillMainBundle/Controller/ScopeController.php @@ -13,20 +13,27 @@ namespace Chill\MainBundle\Controller; use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Form\ScopeType; +use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; +use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; /** * Class ScopeController. */ class ScopeController extends AbstractController { + public function __construct( + private readonly EntityManagerInterface $entityManager, + private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, + ) {} + /** * Creates a new Scope entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/create", name="admin_scope_create", methods={"POST"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/create', name: 'admin_scope_create', methods: ['POST'])] public function createAction(Request $request) { $scope = new Scope(); @@ -34,7 +41,7 @@ class ScopeController extends AbstractController $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - $em = $this->getDoctrine()->getManager(); + $em = $this->managerRegistry->getManager(); $em->persist($scope); $em->flush(); @@ -49,20 +56,18 @@ class ScopeController extends AbstractController /** * Displays a form to edit an existing Scope entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/{id}/edit", name="admin_scope_edit") */ - public function editAction(mixed $id) + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/{id}/edit', name: 'admin_scope_edit')] + public function editAction(Scope $scope, Request $request): Response { - $em = $this->getDoctrine()->getManager(); - - $scope = $em->getRepository(Scope::class)->find($id); - - if (!$scope) { - throw $this->createNotFoundException('Unable to find Scope entity.'); - } - $editForm = $this->createEditForm($scope); + $editForm->handleRequest($request); + + if ($editForm->isSubmitted() && $editForm->isValid()) { + $this->entityManager->flush(); + + return $this->redirectToRoute('admin_scope_edit', ['id' => $scope->getId()]); + } return $this->render('@ChillMain/Scope/edit.html.twig', [ 'entity' => $scope, @@ -72,12 +77,11 @@ class ScopeController extends AbstractController /** * Lists all Scope entities. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/", name="admin_scope") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/', name: 'admin_scope')] public function indexAction() { - $em = $this->getDoctrine()->getManager(); + $em = $this->managerRegistry->getManager(); $entities = $em->getRepository(Scope::class)->findAll(); @@ -88,9 +92,8 @@ class ScopeController extends AbstractController /** * Displays a form to create a new Scope entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/new", name="admin_scope_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/new', name: 'admin_scope_new')] public function newAction() { $scope = new Scope(); @@ -107,7 +110,7 @@ class ScopeController extends AbstractController */ public function showAction(mixed $id) { - $em = $this->getDoctrine()->getManager(); + $em = $this->managerRegistry->getManager(); $scope = $em->getRepository(Scope::class)->find($id); @@ -120,44 +123,12 @@ class ScopeController extends AbstractController ]); } - /** - * Edits an existing Scope entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/{id}/update", name="admin_scope_update", methods={"POST", "PUT"}) - */ - public function updateAction(Request $request, mixed $id) - { - $em = $this->getDoctrine()->getManager(); - - $scope = $em->getRepository(Scope::class)->find($id); - - if (!$scope) { - throw $this->createNotFoundException('Unable to find Scope entity.'); - } - - $editForm = $this->createEditForm($scope); - $editForm->handleRequest($request); - - if ($editForm->isSubmitted() && $editForm->isValid()) { - $em->flush(); - - return $this->redirectToRoute('admin_scope_edit', ['id' => $id]); - } - - return $this->render('@ChillMain/Scope/edit.html.twig', [ - 'entity' => $scope, - 'edit_form' => $editForm->createView(), - ]); - } - /** * Creates a form to create a Scope entity. * * @param Scope $scope The entity - * - * @return \Symfony\Component\Form\Form The form */ - private function createCreateForm(Scope $scope) + private function createCreateForm(Scope $scope): FormInterface { $form = $this->createForm(ScopeType::class, $scope, [ 'action' => $this->generateUrl('admin_scope_create'), @@ -173,15 +144,10 @@ class ScopeController extends AbstractController * Creates a form to edit a Scope entity. * * @param Scope $scope The entity - * - * @return \Symfony\Component\Form\Form The form */ - private function createEditForm(Scope $scope) + private function createEditForm(Scope $scope): FormInterface { - $form = $this->createForm(ScopeType::class, $scope, [ - 'action' => $this->generateUrl('admin_scope_update', ['id' => $scope->getId()]), - 'method' => 'PUT', - ]); + $form = $this->createForm(ScopeType::class, $scope); $form->add('submit', SubmitType::class, ['label' => 'Update']); diff --git a/src/Bundle/ChillMainBundle/Controller/SearchController.php b/src/Bundle/ChillMainBundle/Controller/SearchController.php index b5d359a53..4c4b6d22c 100644 --- a/src/Bundle/ChillMainBundle/Controller/SearchController.php +++ b/src/Bundle/ChillMainBundle/Controller/SearchController.php @@ -32,13 +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") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/search/advanced/{name}', name: 'chill_main_advanced_search')] public function advancedSearchAction(mixed $name, Request $request) { try { @@ -83,9 +79,7 @@ class SearchController extends AbstractController ); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search/advanced", name="chill_main_advanced_search_list") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/search/advanced', name: 'chill_main_advanced_search_list')] public function advancedSearchListAction(Request $request) { /** @var Chill\MainBundle\Search\SearchProvider $variable */ @@ -102,9 +96,7 @@ class SearchController extends AbstractController return $this->render('@ChillMain/Search/choose_list.html.twig'); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search.{_format}", name="chill_main_search", requirements={"_format"="html|json"}, defaults={"_format"="html"}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/search.{_format}', name: 'chill_main_search', requirements: ['_format' => 'html|json'], defaults: ['_format' => 'html'])] public function searchAction(Request $request, mixed $_format) { $pattern = trim((string) $request->query->get('q', '')); @@ -194,14 +186,12 @@ class SearchController extends AbstractController ); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/api/1.0/search.{_format}", name="chill_main_search_global", requirements={"_format"="json"}, defaults={"_format"="json"}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/api/1.0/search.{_format}', name: 'chill_main_search_global', requirements: ['_format' => 'json'], defaults: ['_format' => 'json'])] public function searchApi(Request $request, mixed $_format): JsonResponse { // TODO this is an incomplete implementation $query = $request->query->get('q', ''); - $types = $request->query->get('type', []); + $types = $request->query->all('type'); if (0 === \count($types)) { throw new BadRequestHttpException('The request must contains at one type'); @@ -221,7 +211,7 @@ class SearchController extends AbstractController $builder = $this ->get('form.factory') ->createNamedBuilder( - null, + '', FormType::class, $data, ['method' => Request::METHOD_POST] diff --git a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php index 7999cb697..97507739e 100644 --- a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php +++ b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php @@ -20,16 +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", - * name="chill_center_timeline", - * methods={"GET"} - * ) - */ + #[Route(path: '/{_locale}/center/timeline', name: 'chill_center_timeline', methods: ['GET'])] public function centerAction(Request $request) { // collect reachable center for each group diff --git a/src/Bundle/ChillMainBundle/Controller/UserApiController.php b/src/Bundle/ChillMainBundle/Controller/UserApiController.php index 6809d3289..262bfdfde 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserApiController.php @@ -13,41 +13,33 @@ namespace Chill\MainBundle\Controller; use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\Pagination\PaginatorInterface; +use Chill\MainBundle\Security\ChillSecurity; use Doctrine\ORM\QueryBuilder; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\Routing\Annotation\Route; class UserApiController extends ApiController { - /** - * @Route( - * "/api/1.0/main/user-current-location.{_format}", - * name="chill_main_user_current_location", - * requirements={ - * "_format": "json" - * } - * ) - */ + public function __construct(private readonly ChillSecurity $security) {} + + #[Route(path: '/api/1.0/main/user-current-location.{_format}', name: 'chill_main_user_current_location', requirements: ['_format' => 'json'])] public function currentLocation(mixed $_format): JsonResponse { + if (!$this->isGranted('ROLE_USER')) { + throw new AccessDeniedHttpException(); + } + return $this->json( - $this->getUser()->getCurrentLocation(), + $this->security->getUser()->getCurrentLocation(), JsonResponse::HTTP_OK, [], ['groups' => ['read']] ); } - /** - * @Route( - * "/api/1.0/main/whoami.{_format}", - * name="chill_main_user_whoami", - * requirements={ - * "_format": "json" - * } - * ) - */ + #[Route(path: '/api/1.0/main/whoami.{_format}', name: 'chill_main_user_whoami', requirements: ['_format' => 'json'])] public function whoami(mixed $_format): JsonResponse { return $this->json( diff --git a/src/Bundle/ChillMainBundle/Controller/UserController.php b/src/Bundle/ChillMainBundle/Controller/UserController.php index 58b99e59e..95c78300f 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserController.php @@ -20,6 +20,7 @@ use Chill\MainBundle\Form\UserPasswordType; use Chill\MainBundle\Form\UserType; use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\MainBundle\Repository\UserRepository; +use Chill\MainBundle\Security\ChillSecurity; use Chill\MainBundle\Templating\Listing\FilterOrderHelper; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; @@ -30,7 +31,6 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -38,17 +38,21 @@ 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 \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder, + private readonly UserRepository $userRepository, + protected ParameterBagInterface $parameterBag, + private readonly TranslatorInterface $translator, + private readonly ChillSecurity $security, + private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, + ) {} - /** - * @Route("/{_locale}/admin/main/user/{uid}/add_link_groupcenter", - * name="admin_user_add_groupcenter") - */ + #[Route(path: '/{_locale}/admin/main/user/{uid}/add_link_groupcenter', name: 'admin_user_add_groupcenter')] public function addLinkGroupCenterAction(Request $request, mixed $uid): Response { - $em = $this->getDoctrine()->getManager(); + $em = $this->managerRegistry->getManager(); $user = $em->getRepository(User::class)->find($uid); @@ -94,13 +98,10 @@ class UserController extends CRUDController ]); } - /** - * @Route("/{_locale}/admin/main/user/{uid}/delete_link_groupcenter/{gcid}", - * name="admin_user_delete_groupcenter") - */ + #[Route(path: '/{_locale}/admin/main/user/{uid}/delete_link_groupcenter/{gcid}', name: 'admin_user_delete_groupcenter')] public function deleteLinkGroupCenterAction(mixed $uid, mixed $gcid, Request $request): RedirectResponse { - $em = $this->getDoctrine()->getManager(); + $em = $this->managerRegistry->getManager(); $user = $em->getRepository(User::class)->find($uid); @@ -158,7 +159,7 @@ class UserController extends CRUDController if ($form->isSubmitted() && $form->isValid()) { $this->onFormValid($action, $entity, $form, $request); - $em = $this->getDoctrine()->getManager(); + $em = $this->managerRegistry->getManager(); $this->onPreFlush($action, $entity, $form, $request); $em->flush(); @@ -194,12 +195,11 @@ class UserController extends CRUDController /** * Displays a form to edit the user current location. - * - * @Route("/{_locale}/main/user/current-location/edit", name="chill_main_user_currentlocation_edit") */ + #[Route(path: '/{_locale}/main/user/current-location/edit', name: 'chill_main_user_currentlocation_edit')] public function editCurrentLocationAction(Request $request) { - $user = $this->getUser(); + $user = $this->security->getUser(); $form = $this->createForm(UserCurrentLocationType::class, $user) ->add('submit', SubmitType::class, ['label' => 'Save']) ->handleRequest($request); @@ -209,7 +209,7 @@ class UserController extends CRUDController $user->setCurrentLocation($currentLocation); - $this->getDoctrine()->getManager()->flush(); + $this->managerRegistry->getManager()->flush(); $this->addFlash('success', $this->translator->trans('Current location successfully updated')); return $this->redirect( @@ -226,9 +226,8 @@ class UserController extends CRUDController /** * Displays a form to edit the user password. - * - * @Route("/{_locale}/admin/user/{id}/edit_password", name="admin_user_edit_password") */ + #[Route(path: '/{_locale}/admin/user/{id}/edit_password', name: 'admin_user_edit_password')] public function editPasswordAction(User $user, Request $request) { $editForm = $this->createEditPasswordForm($user); @@ -243,9 +242,9 @@ class UserController extends CRUDController 'user' => $user->getUsername(), ]); - $user->setPassword($this->passwordEncoder->encodePassword($user, $password)); + $user->setPassword($this->passwordEncoder->hashPassword($user, $password)); - $this->getDoctrine()->getManager()->flush(); + $this->managerRegistry->getManager()->flush(); $this->addFlash('success', $this->translator->trans('Password successfully updated!')); return $this->redirect( @@ -346,7 +345,7 @@ class UserController extends CRUDController // for "new", encode the password if ('new' === $action && $this->parameterBag->get('chill_main.access_user_change_password')) { $entity->setPassword($this->passwordEncoder - ->encodePassword($entity, $form['plainPassword']->getData())); + ->hashPassword($entity, $form['plainPassword']->getData())); } // default behaviour @@ -422,7 +421,7 @@ class UserController extends CRUDController private function getPersistedGroupCenter(GroupCenter $groupCenter) { - $em = $this->getDoctrine()->getManager(); + $em = $this->managerRegistry->getManager(); $groupCenterManaged = $em->getRepository(GroupCenter::class) ->findOneBy([ diff --git a/src/Bundle/ChillMainBundle/Controller/UserExportController.php b/src/Bundle/ChillMainBundle/Controller/UserExportController.php index e25e6074f..6d944a4c3 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserExportController.php @@ -27,16 +27,14 @@ final readonly class UserExportController private UserRepositoryInterface $userRepository, private Security $security, private TranslatorInterface $translator, - ) { - } + ) {} /** * @throws \League\Csv\CannotInsertRecord * @throws \League\Csv\Exception * @throws \League\Csv\UnavailableStream - * - * @Route("/{_locale}/admin/main/users/export/list.{_format}", requirements={"_format": "csv"}, name="chill_main_users_export_list") */ + #[Route(path: '/{_locale}/admin/main/users/export/list.{_format}', requirements: ['_format' => 'csv'], name: 'chill_main_users_export_list')] public function userList(Request $request, string $_format = 'csv'): StreamedResponse { if (!$this->security->isGranted('ROLE_ADMIN')) { @@ -96,9 +94,8 @@ final readonly class UserExportController * @throws \League\Csv\CannotInsertRecord * @throws \League\Csv\Exception * @throws \League\Csv\UnavailableStream - * - * @Route("/{_locale}/admin/main/users/export/permissions.{_format}", requirements={"_format": "csv"}, name="chill_main_users_export_permissions") */ + #[Route(path: '/{_locale}/admin/main/users/export/permissions.{_format}', requirements: ['_format' => 'csv'], name: 'chill_main_users_export_permissions')] public function userPermissionsList(string $_format = 'csv'): StreamedResponse { if (!$this->security->isGranted('ROLE_ADMIN')) { diff --git a/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php b/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php index 144c27688..1bbf5c0c1 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php @@ -21,12 +21,9 @@ 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") - */ + #[Route(path: '/{_locale}/admin/main/user/{id}/job-scope-history', name: 'admin_user_job_scope_history')] public function indexAction(User $user): Response { $jobHistories = $user->getUserJobHistoriesOrdered(); diff --git a/src/Bundle/ChillMainBundle/Controller/UserProfileController.php b/src/Bundle/ChillMainBundle/Controller/UserProfileController.php index 3b83069bb..a48d1a1e2 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserProfileController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserProfileController.php @@ -12,29 +12,35 @@ declare(strict_types=1); namespace Chill\MainBundle\Controller; use Chill\MainBundle\Form\UserPhonenumberType; +use Chill\MainBundle\Security\ChillSecurity; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Component\Routing\Annotation\Route; -class UserProfileController extends AbstractController +final class UserProfileController extends AbstractController { public function __construct( private readonly TranslatorInterface $translator, - ) { - } + private readonly ChillSecurity $security, + private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, + ) {} /** * User profile that allows editing of phonenumber and visualization of certain data. - * - * @Route("/{_locale}/main/user/my-profile", name="chill_main_user_profile") */ + #[Route(path: '/{_locale}/main/user/my-profile', name: 'chill_main_user_profile')] public function __invoke(Request $request) { - $user = $this->getUser(); + if (!$this->security->isGranted('ROLE_USER')) { + throw new AccessDeniedHttpException(); + } + + $user = $this->security->getUser(); $editForm = $this->createPhonenumberEditForm($user); $editForm->handleRequest($request); @@ -43,7 +49,7 @@ class UserProfileController extends AbstractController $user->setPhonenumber($phonenumber); - $this->getDoctrine()->getManager()->flush(); + $this->managerRegistry->getManager()->flush(); $this->addFlash('success', $this->translator->trans('user.profile.Phonenumber successfully updated!')); return $this->redirectToRoute('chill_main_user_profile'); diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php index dd7d642c9..28dca8016 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php @@ -29,15 +29,12 @@ 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. - * - * @Route("/api/1.0/main/workflow/my", methods={"GET"}) */ + #[Route(path: '/api/1.0/main/workflow/my', methods: ['GET'])] public function myWorkflow(Request $request): JsonResponse { if (!$this->security->isGranted('ROLE_USER') || !$this->security->getUser() instanceof User) { @@ -74,9 +71,8 @@ class WorkflowApiController /** * Return a list of workflow which are waiting an action for the user. - * - * @Route("/api/1.0/main/workflow/my-cc", methods={"GET"}) */ + #[Route(path: '/api/1.0/main/workflow/my-cc', methods: ['GET'])] public function myWorkflowCc(Request $request): JsonResponse { if (!$this->security->isGranted('ROLE_USER') || !$this->security->getUser() instanceof User) { @@ -111,17 +107,13 @@ class WorkflowApiController ); } - /** - * @Route("/api/1.0/main/workflow/{id}/subscribe", methods={"POST"}) - */ + #[Route(path: '/api/1.0/main/workflow/{id}/subscribe', methods: ['POST'])] public function subscribe(EntityWorkflow $entityWorkflow, Request $request): Response { return $this->handleSubscription($entityWorkflow, $request, 'subscribe'); } - /** - * @Route("/api/1.0/main/workflow/{id}/unsubscribe", methods={"POST"}) - */ + #[Route(path: '/api/1.0/main/workflow/{id}/unsubscribe', methods: ['POST'])] public function unsubscribe(EntityWorkflow $entityWorkflow, Request $request): Response { return $this->handleSubscription($entityWorkflow, $request, 'unsubscribe'); diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php index a88248c1a..d75e42012 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php @@ -20,6 +20,7 @@ use Chill\MainBundle\Form\WorkflowStepType; use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository; use Chill\MainBundle\Security\Authorization\EntityWorkflowVoter; +use Chill\MainBundle\Security\ChillSecurity; use Chill\MainBundle\Workflow\EntityWorkflowManager; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -27,10 +28,9 @@ use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\Security\Core\Exception\AccessDeniedException; -use Symfony\Component\Security\Core\Security; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Workflow\Registry; use Symfony\Component\Workflow\TransitionBlocker; @@ -38,13 +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 ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} - /** - * @Route("/{_locale}/main/workflow/create", name="chill_main_workflow_create") - */ + #[Route(path: '/{_locale}/main/workflow/create', name: 'chill_main_workflow_create')] public function create(Request $request): Response { if (!$request->query->has('entityClass')) { @@ -64,7 +60,7 @@ class WorkflowController extends AbstractController ->setRelatedEntityClass($request->query->get('entityClass')) ->setRelatedEntityId($request->query->getInt('entityId')) ->setWorkflowName($request->query->get('workflow')) - ->addSubscriberToFinal($this->getUser()); + ->addSubscriberToFinal($this->security->getUser()); $errors = $this->validator->validate($entityWorkflow, null, ['creation']); @@ -81,16 +77,14 @@ class WorkflowController extends AbstractController $this->denyAccessUnlessGranted(EntityWorkflowVoter::CREATE, $entityWorkflow); - $em = $this->getDoctrine()->getManager(); + $em = $this->managerRegistry->getManager(); $em->persist($entityWorkflow); $em->flush(); return $this->redirectToRoute('chill_main_workflow_show', ['id' => $entityWorkflow->getId()]); } - /** - * @Route("/{_locale}/main/workflow/{id}/delete", name="chill_main_workflow_delete") - */ + #[Route(path: '/{_locale}/main/workflow/{id}/delete', name: 'chill_main_workflow_delete')] public function delete(EntityWorkflow $entityWorkflow, Request $request): Response { $this->denyAccessUnlessGranted(EntityWorkflowVoter::DELETE, $entityWorkflow); @@ -115,9 +109,7 @@ class WorkflowController extends AbstractController ]); } - /** - * @Route("/{_locale}/main/workflow-step/{id}/access_key", name="chill_main_workflow_grant_access_by_key") - */ + #[Route(path: '/{_locale}/main/workflow-step/{id}/access_key', name: 'chill_main_workflow_grant_access_by_key')] public function getAccessByAccessKey(EntityWorkflowStep $entityWorkflowStep, Request $request): Response { if (null === $accessKey = $request->query->get('accessKey', null)) { @@ -125,17 +117,17 @@ class WorkflowController extends AbstractController } if (!$this->getUser() instanceof User) { - throw new AccessDeniedException('Not a valid user'); + throw new AccessDeniedHttpException('Not a valid user'); } if ($entityWorkflowStep->getAccessKey() !== $accessKey) { - throw new AccessDeniedException('Access key is invalid'); + throw new AccessDeniedHttpException('Access key is invalid'); } if (!$entityWorkflowStep->isWaitingForTransition()) { $this->addFlash('error', $this->translator->trans('workflow.Steps is not waiting for transition. Maybe someone apply the transition before you ?')); } else { - $entityWorkflowStep->addDestUserByAccessKey($this->getUser()); + $entityWorkflowStep->addDestUserByAccessKey($this->security->getUser()); $this->entityManager->flush(); $this->addFlash('success', $this->translator->trans('workflow.You get access to this step')); } @@ -145,18 +137,17 @@ class WorkflowController extends AbstractController /** * Previous workflows where the user has applyed a transition. - * - * @Route("/{_locale}/main/workflow/list/previous_transitionned", name="chill_main_workflow_list_previous_transitionned") */ + #[Route(path: '/{_locale}/main/workflow/list/previous_transitionned', name: 'chill_main_workflow_list_previous_transitionned')] public function myPreviousWorkflowsTransitionned(Request $request): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); - $total = $this->entityWorkflowRepository->countByPreviousTransitionned($this->getUser()); + $total = $this->entityWorkflowRepository->countByPreviousTransitionned($this->security->getUser()); $paginator = $this->paginatorFactory->create($total); $workflows = $this->entityWorkflowRepository->findByPreviousTransitionned( - $this->getUser(), + $this->security->getUser(), ['createdAt' => 'DESC'], $paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber() @@ -175,18 +166,17 @@ class WorkflowController extends AbstractController /** * Previous workflows where the user was mentioned, but did not give any reaction. - * - * @Route("/{_locale}/main/workflow/list/previous_without_reaction", name="chill_main_workflow_list_previous_without_reaction") */ + #[Route(path: '/{_locale}/main/workflow/list/previous_without_reaction', name: 'chill_main_workflow_list_previous_without_reaction')] public function myPreviousWorkflowsWithoutReaction(Request $request): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); - $total = $this->entityWorkflowRepository->countByPreviousDestWithoutReaction($this->getUser()); + $total = $this->entityWorkflowRepository->countByPreviousDestWithoutReaction($this->security->getUser()); $paginator = $this->paginatorFactory->create($total); $workflows = $this->entityWorkflowRepository->findByPreviousDestWithoutReaction( - $this->getUser(), + $this->security->getUser(), ['createdAt' => 'DESC'], $paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber() @@ -203,18 +193,16 @@ class WorkflowController extends AbstractController ); } - /** - * @Route("/{_locale}/main/workflow/list/cc", name="chill_main_workflow_list_cc") - */ + #[Route(path: '/{_locale}/main/workflow/list/cc', name: 'chill_main_workflow_list_cc')] public function myWorkflowsCc(Request $request): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); - $total = $this->entityWorkflowRepository->countByDest($this->getUser()); + $total = $this->entityWorkflowRepository->countByDest($this->security->getUser()); $paginator = $this->paginatorFactory->create($total); $workflows = $this->entityWorkflowRepository->findByCc( - $this->getUser(), + $this->security->getUser(), ['createdAt' => 'DESC'], $paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber() @@ -230,18 +218,16 @@ class WorkflowController extends AbstractController ); } - /** - * @Route("/{_locale}/main/workflow/list/dest", name="chill_main_workflow_list_dest") - */ + #[Route(path: '/{_locale}/main/workflow/list/dest', name: 'chill_main_workflow_list_dest')] public function myWorkflowsDest(Request $request): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); - $total = $this->entityWorkflowRepository->countByDest($this->getUser()); + $total = $this->entityWorkflowRepository->countByDest($this->security->getUser()); $paginator = $this->paginatorFactory->create($total); $workflows = $this->entityWorkflowRepository->findByDest( - $this->getUser(), + $this->security->getUser(), ['createdAt' => 'DESC'], $paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber() @@ -257,18 +243,16 @@ class WorkflowController extends AbstractController ); } - /** - * @Route("/{_locale}/main/workflow/list/subscribed", name="chill_main_workflow_list_subscribed") - */ + #[Route(path: '/{_locale}/main/workflow/list/subscribed', name: 'chill_main_workflow_list_subscribed')] public function myWorkflowsSubscribed(Request $request): Response { $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); - $total = $this->entityWorkflowRepository->countBySubscriber($this->getUser()); + $total = $this->entityWorkflowRepository->countBySubscriber($this->security->getUser()); $paginator = $this->paginatorFactory->create($total); $workflows = $this->entityWorkflowRepository->findBySubscriber( - $this->getUser(), + $this->security->getUser(), ['createdAt' => 'DESC'], $paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber() @@ -284,9 +268,7 @@ class WorkflowController extends AbstractController ); } - /** - * @Route("/{_locale}/main/workflow/{id}/show", name="chill_main_workflow_show") - */ + #[Route(path: '/{_locale}/main/workflow/{id}/show', name: 'chill_main_workflow_show')] public function show(EntityWorkflow $entityWorkflow, Request $request): Response { $this->denyAccessUnlessGranted(EntityWorkflowVoter::SEE, $entityWorkflow); diff --git a/src/Bundle/ChillMainBundle/Cron/CronManager.php b/src/Bundle/ChillMainBundle/Cron/CronManager.php index a5912ceff..e32e44817 100644 --- a/src/Bundle/ChillMainBundle/Cron/CronManager.php +++ b/src/Bundle/ChillMainBundle/Cron/CronManager.php @@ -55,8 +55,7 @@ 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/DataFixtures/ORM/LoadUsers.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php index 8cb335fba..1c99a3a74 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php @@ -18,7 +18,6 @@ use Doctrine\Persistence\ObjectManager; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Security\Core\Encoder\EncoderFactory; -use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder; /** * Load fixtures users into database. @@ -65,7 +64,7 @@ class LoadUsers extends AbstractFixture implements ContainerAwareInterface, Orde foreach (self::$refs as $username => $params) { $user = new User(); - $defaultEncoder = new MessageDigestPasswordEncoder('sha512', true, 5000); + $defaultEncoder = new \Symfony\Component\PasswordHasher\Hasher\MessageDigestPasswordHasher('sha512', true, 5000); $encoderFactory = new EncoderFactory([ User::class => $defaultEncoder, diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 0e91347f3..9d788c64e 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -15,7 +15,9 @@ use Chill\MainBundle\Controller\AddressApiController; use Chill\MainBundle\Controller\CenterController; use Chill\MainBundle\Controller\CivilityApiController; use Chill\MainBundle\Controller\CivilityController; +use Chill\MainBundle\Controller\CountryApiController; use Chill\MainBundle\Controller\CountryController; +use Chill\MainBundle\Controller\GeographicalUnitApiController; use Chill\MainBundle\Controller\LanguageController; use Chill\MainBundle\Controller\LocationController; use Chill\MainBundle\Controller\LocationTypeController; @@ -667,6 +669,7 @@ class ChillMainExtension extends Extension implements ], [ 'class' => Country::class, + 'controller' => CountryApiController::class, 'name' => 'country', 'base_path' => '/api/1.0/main/country', 'base_role' => 'ROLE_USER', @@ -787,6 +790,7 @@ class ChillMainExtension extends Extension implements ], [ 'class' => GeographicalUnitLayer::class, + 'controller' => GeographicalUnitApiController::class, 'name' => 'geographical-unit-layer', 'base_path' => '/api/1.0/main/geographical-unit-layer', 'base_role' => 'ROLE_USER', diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/RoleProvidersCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/RoleProvidersCompilerPass.php deleted file mode 100644 index c4bbc846d..000000000 --- a/src/Bundle/ChillMainBundle/DependencyInjection/RoleProvidersCompilerPass.php +++ /dev/null @@ -1,41 +0,0 @@ -hasDefinition('chill.main.role_provider')) { - throw new \LogicException('service chill.main.role_provider is not defined. It is required by RoleProviderCompilerPass'); - } - - $definition = $container->getDefinition( - 'chill.main.role_provider' - ); - - $taggedServices = $container->findTaggedServiceIds( - 'chill.role' - ); - - foreach ($taggedServices as $id => $tagAttributes) { - $definition->addMethodCall( - 'addProvider', - [new Reference($id)] - ); - } - } -} diff --git a/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php b/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php index 907997258..e6ac2308a 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php @@ -21,9 +21,7 @@ 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 beed15f31..de6af9625 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php @@ -15,9 +15,7 @@ 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/Doctrine/Model/TrackCreationTrait.php b/src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationTrait.php index 29f1c2f43..3286390f7 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationTrait.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationTrait.php @@ -12,26 +12,18 @@ declare(strict_types=1); namespace Chill\MainBundle\Doctrine\Model; use Chill\MainBundle\Entity\User; -use DateTime; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation as Serializer; trait TrackCreationTrait { - /** - * @ORM\Column(type="datetime_immutable", nullable=true, options={"default": NULL}) - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true, options: ['default' => null])] private ?\DateTimeImmutable $createdAt = null; - /** - * @ORM\ManyToOne(targetEntity=User::class) - * - * @ORM\JoinColumn(nullable=true) - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(nullable: true)] private ?User $createdBy = null; public function getCreatedAt(): ?\DateTimeInterface diff --git a/src/Bundle/ChillMainBundle/Doctrine/Model/TrackUpdateTrait.php b/src/Bundle/ChillMainBundle/Doctrine/Model/TrackUpdateTrait.php index 8a3f98972..551b5a50f 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Model/TrackUpdateTrait.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Model/TrackUpdateTrait.php @@ -12,26 +12,18 @@ declare(strict_types=1); namespace Chill\MainBundle\Doctrine\Model; use Chill\MainBundle\Entity\User; -use DateTime; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation as Serializer; trait TrackUpdateTrait { - /** - * @ORM\Column(type="datetime_immutable", nullable=true, options={"default": NULL}) - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true, options: ['default' => null])] private ?\DateTimeImmutable $updatedAt = null; - /** - * @ORM\ManyToOne(targetEntity=User::class) - * - * @ORM\JoinColumn(nullable=true) - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(nullable: true)] private ?User $updatedBy = null; public function getUpdatedAt(): ?\DateTimeInterface diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php index f6584fddd..38b309a76 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -17,7 +17,6 @@ use Chill\MainBundle\Doctrine\Model\TrackCreationTrait; use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface; use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait; use Chill\ThirdPartyBundle\Entity\ThirdParty; -use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; @@ -26,13 +25,10 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; /** * Address. - * - * @ORM\Entity - * - * @ORM\Table(name="chill_main_address") - * - * @ORM\HasLifecycleCallbacks */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'chill_main_address')] class Address implements TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; @@ -55,62 +51,39 @@ class Address implements TrackCreationInterface, TrackUpdateInterface */ final public const ADDR_REFERENCE_STATUS_REVIEWED = 'reviewed'; - /** - * @ORM\ManyToOne(targetEntity=AddressReference::class) - * - * @Groups({"write"}) - */ + #[Groups(['write'])] + #[ORM\ManyToOne(targetEntity: AddressReference::class)] private ?AddressReference $addressReference = null; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) - */ + #[Groups(['write'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $buildingName = ''; - /** - * @ORM\Column(type="boolean", options={"default": false}) - * - * @Groups({"write"}) - */ + #[Groups(['write'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])] private bool $confidential = false; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) - */ + #[Groups(['write'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $corridor = ''; /** * used for the CEDEX information. - * - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $distribution = ''; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) - */ + #[Groups(['write'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $extra = ''; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) - */ + #[Groups(['write'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $flat = ''; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) - */ + #[Groups(['write'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $floor = ''; /** @@ -119,122 +92,85 @@ class Address implements TrackCreationInterface, TrackUpdateInterface * This list is computed by a materialized view. It won't be populated until a refresh is done * on the materialized view. * - * @var Collection + * @var Collection * * @readonly - * - * @ORM\ManyToMany(targetEntity=GeographicalUnit::class) - * - * @ORM\JoinTable( - * name="view_chill_main_address_geographical_unit", - * joinColumns={@ORM\JoinColumn(name="address_id")}, - * inverseJoinColumns={@ORM\JoinColumn(name="geographical_unit_id")} - * ) */ + #[ORM\ManyToMany(targetEntity: GeographicalUnit::class)] + #[ORM\JoinTable(name: 'view_chill_main_address_geographical_unit', joinColumns: [new ORM\JoinColumn(name: 'address_id')], inverseJoinColumns: [new ORM\JoinColumn(name: 'geographical_unit_id')])] private Collection $geographicalUnits; /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - * - * @Groups({"write"}) - * * @readonly */ + #[Groups(['write'])] + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; /** * True if the address is a "no address", aka homeless person, ... - * - * @Groups({"write"}) - * - * @ORM\Column(type="boolean", options={"default": false}) */ + #[Groups(['write'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])] private bool $isNoAddress = false; /** * A ThirdParty reference for person's addresses that are linked to a third party. - * - * @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty") - * - * @Groups({"write"}) - * - * @ORM\JoinColumn(nullable=true, onDelete="SET NULL") */ + #[Groups(['write'])] + #[ORM\ManyToOne(targetEntity: ThirdParty::class)] + #[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')] private ?ThirdParty $linkedToThirdParty = null; /** * A geospatial field storing the coordinates of the Address. - * - * @ORM\Column(type="point", nullable=true) - * - * @Groups({"write"}) */ + #[Groups(['write'])] + #[ORM\Column(type: 'point', nullable: true)] private ?Point $point = null; - /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode") - * - * @ORM\JoinColumn(nullable=false) - * - * @Groups({"write"}) - */ + #[Groups(['write'])] + #[ORM\ManyToOne(targetEntity: PostalCode::class)] + #[ORM\JoinColumn(nullable: false)] private ?PostalCode $postcode = null; /** * @var self::ADDR_REFERENCE_STATUS_* - * - * @ORM\Column(type="text", nullable=false, options={"default": self::ADDR_REFERENCE_STATUS_MATCH}) */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => self::ADDR_REFERENCE_STATUS_MATCH])] private string $refStatus = self::ADDR_REFERENCE_STATUS_MATCH; - /** - * @ORM\Column(type="datetime_immutable", nullable=false, options={"default": "CURRENT_TIMESTAMP"}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false, options: ['default' => 'CURRENT_TIMESTAMP'])] private \DateTimeImmutable $refStatusLastUpdate; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) - */ + #[Groups(['write'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $steps = ''; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) - */ + #[Groups(['write'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $street = ''; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) - */ + #[Groups(['write'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $streetNumber = ''; /** * Indicates when the address starts validation. Used to build an history * of address. By default, the current date. - * - * @ORM\Column(type="date") - * - * @Groups({"write"}) */ + #[Groups(['write'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE)] private \DateTime $validFrom; /** * Indicates when the address ends. Used to build an history * of address. - * - * @ORM\Column(type="date", nullable=true) - * - * @Groups({"write"}) */ + #[Groups(['write'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)] private ?\DateTime $validTo = null; public function __construct() @@ -510,7 +446,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface return $this; } - public function setLinkedToThirdParty($linkedToThirdParty): self + public function setLinkedToThirdParty(?ThirdParty $linkedToThirdParty): self { $this->linkedToThirdParty = $linkedToThirdParty; diff --git a/src/Bundle/ChillMainBundle/Entity/AddressReference.php b/src/Bundle/ChillMainBundle/Entity/AddressReference.php index 49b510f8c..b512162bf 100644 --- a/src/Bundle/ChillMainBundle/Entity/AddressReference.php +++ b/src/Bundle/ChillMainBundle/Entity/AddressReference.php @@ -15,112 +15,68 @@ use Chill\MainBundle\Doctrine\Model\Point; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; -/** - * @ORM\Entity - * - * @ORM\Table(name="chill_main_address_reference", indexes={ - * - * @ORM\Index(name="address_refid", columns={"refId"}) - * }, - * uniqueConstraints={ - * - * @ORM\UniqueConstraint(name="chill_main_address_reference_unicity", columns={"refId", "source"}) - * }) - * - * @ORM\HasLifecycleCallbacks - */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'chill_main_address_reference')] +#[ORM\Index(name: 'address_refid', columns: ['refId'])] +#[ORM\UniqueConstraint(name: 'chill_main_address_reference_unicity', columns: ['refId', 'source'])] class AddressReference { /** * This is an internal column which is populated by database. * * This column will ease the search operations - * - * @ORM\Column(type="text", options={"default": ""}) */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''])] private string $addressCanonical = ''; - /** - * @ORM\Column(type="datetime_immutable", nullable=true) - * - * @groups({"read"}) - */ + #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)] private ?\DateTimeImmutable $createdAt = null; - /** - * @ORM\Column(type="datetime_immutable", nullable=true) - * - * @groups({"read"}) - */ + #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)] private ?\DateTimeImmutable $deletedAt = null; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - * - * @groups({"read"}) - */ + #[Groups(['read'])] + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @groups({"read"}) - */ + #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $municipalityCode = ''; /** * A geospatial field storing the coordinates of the Address. - * - * @ORM\Column(type="point") - * - * @groups({"read"}) */ + #[Groups(['read'])] + #[ORM\Column(type: 'point')] private ?Point $point = null; - /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode") - * - * @groups({"read"}) - */ + #[Groups(['read'])] + #[ORM\ManyToOne(targetEntity: PostalCode::class)] private ?PostalCode $postcode = null; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @groups({"read"}) - */ + #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $refId = ''; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @groups({"read"}) - */ + #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $source = ''; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @groups({"read"}) - */ + #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $street = ''; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @groups({"read"}) - */ + #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $streetNumber = ''; - /** - * @ORM\Column(type="datetime_immutable", nullable=true) - * - * @groups({"read"}) - */ + #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)] private ?\DateTimeImmutable $updatedAt = null; public function getCreatedAt(): ?\DateTimeImmutable diff --git a/src/Bundle/ChillMainBundle/Entity/Center.php b/src/Bundle/ChillMainBundle/Entity/Center.php index b81200bdb..0d0858a6e 100644 --- a/src/Bundle/ChillMainBundle/Entity/Center.php +++ b/src/Bundle/ChillMainBundle/Entity/Center.php @@ -16,51 +16,33 @@ use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation as Serializer; -/** - * @ORM\Entity - * - * @ORM\Table(name="centers") - */ +#[ORM\Entity] +#[ORM\Table(name: 'centers')] class Center implements HasCenterInterface, \Stringable { /** - * @var Collection - * - * @ORM\OneToMany( - * targetEntity="Chill\MainBundle\Entity\GroupCenter", - * mappedBy="center" - * ) + * @var Collection */ + #[ORM\OneToMany(mappedBy: 'center', targetEntity: GroupCenter::class)] private Collection $groupCenters; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - * - * @Serializer\Groups({"docgen:read"}) - */ + #[Serializer\Groups(['docgen:read'])] + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; - /** - * @ORM\Column(type="string", length=255) - * - * @Serializer\Groups({"docgen:read"}) - */ + #[Serializer\Groups(['docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] private string $name = ''; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $isActive = true; /** - * @var Collection - * - * @ORM\ManyToMany(targetEntity=Regroupment::class, mappedBy="centers") + * @var Collection */ + #[ORM\ManyToMany(targetEntity: Regroupment::class, mappedBy: 'centers')] private Collection $regroupments; /** @@ -100,10 +82,7 @@ class Center implements HasCenterInterface, \Stringable return $this->groupCenters; } - /** - * @return int - */ - public function getId() + public function getId(): ?int { return $this->id; } @@ -132,7 +111,7 @@ class Center implements HasCenterInterface, \Stringable /** * @return $this */ - public function setName($name) + public function setName(string $name) { $this->name = $name; diff --git a/src/Bundle/ChillMainBundle/Entity/Civility.php b/src/Bundle/ChillMainBundle/Entity/Civility.php index 322155fe5..2105c8b87 100644 --- a/src/Bundle/ChillMainBundle/Entity/Civility.php +++ b/src/Bundle/ChillMainBundle/Entity/Civility.php @@ -14,54 +14,32 @@ namespace Chill\MainBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation as Serializer; -/** - * @ORM\Table(name="chill_main_civility") - * - * @ORM\Entity - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={"chill_main_civility": Civility::class}) - */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_main_civility' => Civility::class])] +#[ORM\Entity] +#[ORM\Table(name: 'chill_main_civility')] class Civility { - /** - * @ORM\Column(type="json") - * - * @Serializer\Groups({"read", "docgen:read"}) - * - * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) - */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] + #[Serializer\Context(['is-translatable' => true], groups: ['docgen:read'])] private array $abbreviation = []; - /** - * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $active = true; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) - */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="json") - * - * @Serializer\Groups({"read", "docgen:read"}) - * - * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) - */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] + #[Serializer\Context(['is-translatable' => true], groups: ['docgen:read'])] private array $name = []; - /** - * @ORM\Column(type="float", name="ordering", nullable=true, options={"default": 0.0}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, name: 'ordering', nullable: true, options: ['default' => '0.0'])] private float $order = 0; public function getAbbreviation(): array diff --git a/src/Bundle/ChillMainBundle/Entity/Country.php b/src/Bundle/ChillMainBundle/Entity/Country.php index 91484ba46..533caeaec 100644 --- a/src/Bundle/ChillMainBundle/Entity/Country.php +++ b/src/Bundle/ChillMainBundle/Entity/Country.php @@ -17,46 +17,30 @@ use Symfony\Component\Serializer\Annotation\Groups; /** * Country. - * - * @ORM\Entity - * - * @ORM\Table(name="country") - * - * @ORM\Cache(usage="READ_ONLY", region="country_cache_region") - * - * @ORM\HasLifecycleCallbacks */ +#[ORM\Entity] +#[ORM\Cache(usage: 'READ_ONLY', region: 'country_cache_region')] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'country')] class Country { - /** - * @ORM\Column(type="string", length=3) - * - * @groups({"read", "docgen:read"}) - * - * @Context({"is-translatable": true}, groups={"docgen:read"}) - */ + #[Groups(['read', 'docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 3)] + #[Context(['is-translatable' => true], groups: ['docgen:read'])] private string $countryCode = ''; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - * - * @groups({"read", "docgen:read"}) - */ + #[Groups(['read', 'docgen:read'])] + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; /** * @var array - * - * @ORM\Column(type="json") - * - * @groups({"read", "docgen:read"}) - * - * @Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] + #[Context(['is-translatable' => true], groups: ['docgen:read'])] private array $name = []; public function getCountryCode(): string diff --git a/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php b/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php index 368c72a52..f2f1194c8 100644 --- a/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php +++ b/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php @@ -13,42 +13,29 @@ namespace Chill\MainBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - * - * @ORM\Table(name="chill_main_cronjob_execution") - */ +#[ORM\Entity] +#[ORM\Table(name: 'chill_main_cronjob_execution')] class CronJobExecution { final public const FAILURE = 100; final public const SUCCESS = 1; - /** - * @ORM\Column(type="datetime_immutable", nullable=true, options={"default": null}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true, options: ['default' => null])] private ?\DateTimeImmutable $lastEnd = null; - /** - * @ORM\Column(type="datetime_immutable", nullable=false) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)] private \DateTimeImmutable $lastStart; - /** - * @ORM\Column(type="integer", nullable=true, options={"default": null}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true, options: ['default' => null])] private ?int $lastStatus = null; - /** - * @ORM\Column(type="json", options={"default": "'{}'::jsonb", "jsonb": true}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => "'{}'::jsonb", 'jsonb' => true])] private array $lastExecutionData = []; - public function __construct(/** - * @ORM\Column(type="text", nullable=false) - * - * @ORM\Id - */ + public function __construct( + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false)] + #[ORM\Id] private string $key, ) { $this->lastStart = new \DateTimeImmutable('now'); diff --git a/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php b/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php index ed9cc07bf..6fdd34cfc 100644 --- a/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php +++ b/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php @@ -15,52 +15,31 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Entity - * - * @ORM\Table(name="chill_main_dashboard_config_item") - */ +#[ORM\Entity] +#[ORM\Table(name: 'chill_main_dashboard_config_item')] class DashboardConfigItem { - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - * - * @Serializer\Groups({"dashboardConfigItem:read", "read"}) - */ + #[Serializer\Groups(['dashboardConfigItem:read', 'read'])] + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="string") - * - * @Serializer\Groups({"dashboardConfigItem:read", "read"}) - * - * @Assert\NotNull - */ + #[Serializer\Groups(['dashboardConfigItem:read', 'read'])] + #[Assert\NotNull] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] private string $type = ''; - /** - * @ORM\Column(type="string") - * - * @Serializer\Groups({"dashboardConfigItem:read", "read"}) - * - * @Assert\NotNull - */ + #[Serializer\Groups(['dashboardConfigItem:read', 'read'])] + #[Assert\NotNull] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] private string $position = ''; - /** - * @ORM\ManyToOne(targetEntity=User::class) - */ + #[ORM\ManyToOne(targetEntity: User::class)] private ?User $user = null; - /** - * @ORM\Column(type="json", options={"default": "[]", "jsonb": true}) - * - * @Serializer\Groups({"dashboardConfigItem:read"}) - */ + #[Serializer\Groups(['dashboardConfigItem:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '[]', 'jsonb' => true])] private array $metadata = []; public function getId(): ?int diff --git a/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php b/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php index cf858d60f..ea0d4ec29 100644 --- a/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php +++ b/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php @@ -11,29 +11,21 @@ declare(strict_types=1); namespace Chill\MainBundle\Entity\Embeddable; -use DateTime; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Embeddable - */ +#[ORM\Embeddable] class CommentEmbeddable { - /** - * @ORM\Column(type="text", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)] private ?string $comment = null; - /** - * @ORM\Column(type="datetime", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)] private ?\DateTime $date = null; /** * Embeddable does not support associations. - * - * @ORM\Column(type="integer", nullable=true) */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true)] private ?int $userId = null; public function getComment(): ?string @@ -69,10 +61,7 @@ class CommentEmbeddable $this->date = $date; } - /** - * @param int $userId - */ - public function setUserId($userId) + public function setUserId(?int $userId) { $this->userId = $userId; } diff --git a/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php b/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php index 3cfed7844..0c2af22f7 100644 --- a/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php +++ b/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php @@ -14,16 +14,13 @@ namespace Chill\MainBundle\Entity\Embeddable; use Chill\MainBundle\Entity\User; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Embeddable - */ +#[ORM\Embeddable] class PrivateCommentEmbeddable { /** - * @ORM\Column(type="json", nullable=false, options={"default": "{}"}) - * * @var array */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: false, options: ['default' => '{}'])] private array $comments = []; public function getCommentForUser(User $user): string @@ -60,7 +57,7 @@ class PrivateCommentEmbeddable return $this; } - public function setComments($comments) + public function setComments(array $comments) { $this->comments = $comments; diff --git a/src/Bundle/ChillMainBundle/Entity/GeographicalUnit.php b/src/Bundle/ChillMainBundle/Entity/GeographicalUnit.php index 5c70b7bfe..668f95482 100644 --- a/src/Bundle/ChillMainBundle/Entity/GeographicalUnit.php +++ b/src/Bundle/ChillMainBundle/Entity/GeographicalUnit.php @@ -13,43 +13,26 @@ namespace Chill\MainBundle\Entity; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table(name="chill_main_geographical_unit", uniqueConstraints={ - * - * @ORM\UniqueConstraint(name="geographical_unit_refid", columns={"layer_id", "unitRefId"}) - * }) - * - * @ORM\Entity(readOnly=true) - */ +#[ORM\Entity(readOnly: true)] +#[ORM\Table(name: 'chill_main_geographical_unit')] +#[ORM\UniqueConstraint(name: 'geographical_unit_refid', columns: ['layer_id', 'unitRefId'])] class GeographicalUnit { - /** - * @ORM\Column(type="text", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)] private string $geom; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity=GeographicalUnitLayer::class, inversedBy="units") - */ + #[ORM\ManyToOne(targetEntity: GeographicalUnitLayer::class, inversedBy: 'units')] private ?GeographicalUnitLayer $layer = null; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $unitName; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $unitRefId; public function getId(): ?int diff --git a/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php b/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php index fda115208..481b530d9 100644 --- a/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php +++ b/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php @@ -25,34 +25,29 @@ class SimpleGeographicalUnitDTO * @readonly * * @psalm-readonly - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] public int $id, /** * @readonly * * @psalm-readonly - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] public string $unitName, /** * @readonly * * @psalm-readonly - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] public string $unitRefId, /** * @readonly * * @psalm-readonly - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] public int $layerId, - ) { - } + ) {} } diff --git a/src/Bundle/ChillMainBundle/Entity/GeographicalUnitLayer.php b/src/Bundle/ChillMainBundle/Entity/GeographicalUnitLayer.php index c875fecd4..5b311b465 100644 --- a/src/Bundle/ChillMainBundle/Entity/GeographicalUnitLayer.php +++ b/src/Bundle/ChillMainBundle/Entity/GeographicalUnitLayer.php @@ -16,46 +16,29 @@ use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation as Serializer; -/** - * @ORM\Table(name="chill_main_geographical_unit_layer", uniqueConstraints={ - * - * @ORM\UniqueConstraint(name="geographical_unit_layer_refid", columns={"refId"}) - * }) - * - * @ORM\Entity - */ +#[ORM\Entity] +#[ORM\Table(name: 'chill_main_geographical_unit_layer')] +#[ORM\UniqueConstraint(name: 'geographical_unit_layer_refid', columns: ['refId'])] class GeographicalUnitLayer { - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="json", nullable=false, options={"default": "[]"}) - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: false, options: ['default' => '[]'])] private array $name = []; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $refId = ''; /** - * @var Collection - * - * @ORM\OneToMany(targetEntity=GeographicalUnit::class, mappedBy="layer") + * @var Collection */ + #[ORM\OneToMany(mappedBy: 'layer', targetEntity: GeographicalUnit::class)] private Collection $units; public function __construct() diff --git a/src/Bundle/ChillMainBundle/Entity/GroupCenter.php b/src/Bundle/ChillMainBundle/Entity/GroupCenter.php index bcd4bc8bd..5a1349bcc 100644 --- a/src/Bundle/ChillMainBundle/Entity/GroupCenter.php +++ b/src/Bundle/ChillMainBundle/Entity/GroupCenter.php @@ -15,51 +15,28 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - * - * @ORM\Table(name="group_centers") - * - * @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region") - */ +#[ORM\Entity] +#[ORM\Cache(usage: 'NONSTRICT_READ_WRITE', region: 'acl_cache_region')] +#[ORM\Table(name: 'group_centers')] class GroupCenter { - /** - * @ORM\ManyToOne( - * targetEntity="Chill\MainBundle\Entity\Center", - * inversedBy="groupCenters" - * ) - * - * @ORM\Cache(usage="NONSTRICT_READ_WRITE") - */ + #[ORM\ManyToOne(targetEntity: Center::class, inversedBy: 'groupCenters')] + #[ORM\Cache(usage: 'NONSTRICT_READ_WRITE')] private ?Center $center = null; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; - /** - * @ORM\ManyToOne( - * targetEntity="Chill\MainBundle\Entity\PermissionsGroup", - * inversedBy="groupCenters") - * - * @ORM\Cache(usage="NONSTRICT_READ_WRITE") - */ + #[ORM\ManyToOne(targetEntity: PermissionsGroup::class, inversedBy: 'groupCenters')] + #[ORM\Cache(usage: 'NONSTRICT_READ_WRITE')] private ?PermissionsGroup $permissionsGroup = null; /** - * @ORM\ManyToMany( - * targetEntity="Chill\MainBundle\Entity\User", - * mappedBy="groupCenters" - * ) - * - * @var Collection + * @var Collection */ + #[ORM\ManyToMany(targetEntity: User::class, mappedBy: 'groupCenters')] private Collection $users; /** diff --git a/src/Bundle/ChillMainBundle/Entity/Language.php b/src/Bundle/ChillMainBundle/Entity/Language.php index 1a91de7b8..894b929ac 100644 --- a/src/Bundle/ChillMainBundle/Entity/Language.php +++ b/src/Bundle/ChillMainBundle/Entity/Language.php @@ -16,35 +16,24 @@ use Symfony\Component\Serializer\Annotation as Serializer; /** * Language. - * - * @ORM\Entity - * - * @ORM\Table(name="language") - * - * @ORM\Cache(usage="READ_ONLY", region="language_cache_region") - * - * @ORM\HasLifecycleCallbacks */ +#[ORM\Entity] +#[ORM\Cache(usage: 'READ_ONLY', region: 'language_cache_region')] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'language')] class Language { - /** - * @ORM\Id - * - * @ORM\Column(type="string") - * - * @Serializer\Groups({"docgen:read"}) - */ + #[Serializer\Groups(['docgen:read'])] + #[ORM\Id] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] private ?string $id = null; /** * @var string array - * - * @ORM\Column(type="json") - * - * @Serializer\Groups({"docgen:read"}) - * - * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] + #[Serializer\Context(['is-translatable' => true], groups: ['docgen:read'])] private array $name = []; /** @@ -70,11 +59,9 @@ class Language /** * Set id. * - * @param string $id - * * @return Language */ - public function setId($id) + public function setId(?string $id) { $this->id = $id; @@ -88,7 +75,7 @@ class Language * * @return Language */ - public function setName($name) + public function setName(array $name) { $this->name = $name; diff --git a/src/Bundle/ChillMainBundle/Entity/Location.php b/src/Bundle/ChillMainBundle/Entity/Location.php index 29a049d35..228fd089f 100644 --- a/src/Bundle/ChillMainBundle/Entity/Location.php +++ b/src/Bundle/ChillMainBundle/Entity/Location.php @@ -20,118 +20,67 @@ use libphonenumber\PhoneNumber; use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation\DiscriminatorMap; -/** - * @ORM\Table(name="chill_main_location") - * - * @ORM\Entity(repositoryClass=LocationRepository::class) - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "location": Location::class - * }) - */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['location' => Location::class])] +#[ORM\Entity(repositoryClass: LocationRepository::class)] +#[ORM\Table(name: 'chill_main_location')] class Location implements TrackCreationInterface, TrackUpdateInterface { - /** - * @ORM\Column(type="boolean", nullable=true) - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)] private bool $active = true; - /** - * @ORM\ManyToOne(targetEntity=Address::class, cascade={"persist"}) - * - * @ORM\JoinColumn(nullable=true) - * - * @Serializer\Groups({"read", "write", "docgen:read"}) - */ + #[Serializer\Groups(['read', 'write', 'docgen:read'])] + #[ORM\ManyToOne(targetEntity: Address::class, cascade: ['persist'])] + #[ORM\JoinColumn(nullable: true)] private ?Address $address = null; - /** - * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $availableForUsers = false; - /** - * @ORM\Column(type="datetime_immutable", nullable=true) - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)] private ?\DateTimeImmutable $createdAt = null; - /** - * @ORM\ManyToOne(targetEntity=User::class) - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\ManyToOne(targetEntity: User::class)] private ?User $createdBy = null; - /** - * @ORM\Column(type="string", length=255, nullable=true) - * - * @Serializer\Groups({"read", "write", "docgen:read"}) - */ + #[Serializer\Groups(['read', 'write', 'docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] private ?string $email = null; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) - */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity=LocationType::class) - * - * @ORM\JoinColumn(nullable=false) - * - * @Serializer\Groups({"read", "write", "docgen:read"}) - */ + #[Serializer\Groups(['read', 'write', 'docgen:read'])] + #[ORM\ManyToOne(targetEntity: LocationType::class)] + #[ORM\JoinColumn(nullable: false)] private ?LocationType $locationType = null; - /** - * @ORM\Column(type="string", length=255, nullable=true) - * - * @Serializer\Groups({"read", "write", "docgen:read"}) - */ + #[Serializer\Groups(['read', 'write', 'docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] private ?string $name = null; - /** - * @ORM\Column(type="phone_number", nullable=true) - * - * @Serializer\Groups({"read", "write", "docgen:read"}) - * - * @PhonenumberConstraint(type="any") - */ + #[Serializer\Groups(['read', 'write', 'docgen:read'])] + #[ORM\Column(type: 'phone_number', nullable: true)] + #[PhonenumberConstraint(type: 'any')] private ?PhoneNumber $phonenumber1 = null; - /** - * @ORM\Column(type="phone_number", nullable=true) - * - * @Serializer\Groups({"read", "write", "docgen:read"}) - * - * @PhonenumberConstraint(type="any") - */ + #[Serializer\Groups(['read', 'write', 'docgen:read'])] + #[ORM\Column(type: 'phone_number', nullable: true)] + #[PhonenumberConstraint(type: 'any')] private ?PhoneNumber $phonenumber2 = null; - /** - * @ORM\Column(type="datetime_immutable", nullable=true) - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)] private ?\DateTimeImmutable $updatedAt = null; - /** - * @ORM\ManyToOne(targetEntity=User::class) - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\ManyToOne(targetEntity: User::class)] private ?User $updatedBy = null; public function getActive(): ?bool diff --git a/src/Bundle/ChillMainBundle/Entity/LocationType.php b/src/Bundle/ChillMainBundle/Entity/LocationType.php index c6a176ab6..df212646a 100644 --- a/src/Bundle/ChillMainBundle/Entity/LocationType.php +++ b/src/Bundle/ChillMainBundle/Entity/LocationType.php @@ -17,17 +17,10 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation\DiscriminatorMap; -/** - * @ORM\Table(name="chill_main_location_type") - * - * @ORM\Entity(repositoryClass=LocationTypeRepository::class) - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "location-type": LocationType::class - * }) - * - * @UniqueEntity({"defaultFor"}) - */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['location-type' => LocationType::class])] +#[UniqueEntity(['defaultFor'])] +#[ORM\Entity(repositoryClass: LocationTypeRepository::class)] +#[ORM\Table(name: 'chill_main_location_type')] class LocationType { final public const DEFAULT_FOR_3PARTY = 'thirdparty'; @@ -40,66 +33,39 @@ class LocationType final public const STATUS_REQUIRED = 'required'; - /** - * @ORM\Column(type="boolean", nullable=true) - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)] private bool $active = true; - /** - * @ORM\Column(type="string", length=32, options={"default": "optional"}) - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 32, options: ['default' => 'optional'])] private string $addressRequired = self::STATUS_OPTIONAL; - /** - * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $availableForUsers = true; - /** - * @ORM\Column(type="string", length=32, options={"default": "optional"}) - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 32, options: ['default' => 'optional'])] private string $contactData = self::STATUS_OPTIONAL; - /** - * @ORM\Column(type="string", nullable=true, length=32, unique=true) - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true, length: 32, unique: true)] private ?string $defaultFor = null; - /** - * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $editableByUsers = true; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) - */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="json") - * - * @Serializer\Groups({"read", "docgen:read"}) - * - * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) - */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] + #[Serializer\Context(['is-translatable' => true], groups: ['docgen:read'])] private array $title = []; public function getActive(): ?bool diff --git a/src/Bundle/ChillMainBundle/Entity/NewsItem.php b/src/Bundle/ChillMainBundle/Entity/NewsItem.php index 604c58c5f..7acf2de86 100644 --- a/src/Bundle/ChillMainBundle/Entity/NewsItem.php +++ b/src/Bundle/ChillMainBundle/Entity/NewsItem.php @@ -19,66 +19,40 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Entity - * - * @ORM\Table(name="chill_main_news") - */ +#[ORM\Entity] +#[ORM\Table(name: 'chill_main_news')] class NewsItem implements TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; use TrackUpdateTrait; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - * - * @Groups({"read"}) - */ + #[Groups(['read'])] + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="text") - * - * @Groups({"read"}) - * - * @Assert\NotBlank - * - * @Assert\NotNull - */ + #[Groups(['read'])] + #[Assert\NotBlank] + #[Assert\NotNull] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] private string $title = ''; - /** - * @ORM\Column(type="text") - * - * @Groups({"read"}) - * - * @Assert\NotBlank - * - * @Assert\NotNull - */ + #[Groups(['read'])] + #[Assert\NotBlank] + #[Assert\NotNull] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] private string $content = ''; - /** - * @ORM\Column(type="date_immutable", nullable=false) - * - * @Assert\NotNull - * - * @Groups({"read"}) - */ + #[Assert\NotNull] + #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: false)] private ?\DateTimeImmutable $startDate = null; - /** - * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Assert\GreaterThanOrEqual(propertyPath="startDate") - * - * @Groups({"read"}) - */ + #[Assert\GreaterThanOrEqual(propertyPath: 'startDate')] + #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])] private ?\DateTimeImmutable $endDate = null; public function getTitle(): string diff --git a/src/Bundle/ChillMainBundle/Entity/Notification.php b/src/Bundle/ChillMainBundle/Entity/Notification.php index 8604b5ee1..d85a144b0 100644 --- a/src/Bundle/ChillMainBundle/Entity/Notification.php +++ b/src/Bundle/ChillMainBundle/Entity/Notification.php @@ -18,44 +18,30 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Context\ExecutionContextInterface; -/** - * @ORM\Entity - * - * @ORM\Table( - * name="chill_main_notification", - * indexes={ - * - * @ORM\Index(name="chill_main_notification_related_entity_idx", columns={"relatedentityclass", "relatedentityid"}) - * } - * ) - * - * @ORM\HasLifecycleCallbacks - */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'chill_main_notification')] +#[ORM\Index(name: 'chill_main_notification_related_entity_idx', columns: ['relatedentityclass', 'relatedentityid'])] class Notification implements TrackUpdateInterface { - /** - * @ORM\Column(type="text", nullable=false) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false)] private string $accessKey; private array $addedAddresses = []; /** - * @var Collection - * - * @ORM\ManyToMany(targetEntity=User::class) - * - * @ORM\JoinTable(name="chill_main_notification_addresses_user") + * @var Collection */ + #[ORM\ManyToMany(targetEntity: User::class)] + #[ORM\JoinTable(name: 'chill_main_notification_addresses_user')] private Collection $addressees; /** * a list of destinee which will receive notifications. * * @var array|string[] - * - * @ORM\Column(type="json") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array $addressesEmails = []; /** @@ -68,76 +54,50 @@ class Notification implements TrackUpdateInterface private ?ArrayCollection $addressesOnLoad = null; /** - * @var Collection - * - * @ORM\OneToMany(targetEntity=NotificationComment::class, mappedBy="notification", orphanRemoval=true) - * - * @ORM\OrderBy({"createdAt": "ASC"}) + * @var Collection */ + #[ORM\OneToMany(mappedBy: 'notification', targetEntity: NotificationComment::class, orphanRemoval: true)] + #[ORM\OrderBy(['createdAt' => \Doctrine\Common\Collections\Criteria::ASC])] private Collection $comments; - /** - * @ORM\Column(type="datetime_immutable") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)] private \DateTimeImmutable $date; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="text") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] private string $message = ''; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] private string $relatedEntityClass = ''; - /** - * @ORM\Column(type="integer") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private int $relatedEntityId; private array $removedAddresses = []; - /** - * @ORM\ManyToOne(targetEntity=User::class) - * - * @ORM\JoinColumn(nullable=true) - */ + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(nullable: true)] private ?User $sender = null; - /** - * @ORM\Column(type="text", options={"default": ""}) - * - * @Assert\NotBlank(message="notification.Title must be defined") - */ + #[Assert\NotBlank(message: 'notification.Title must be defined')] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''])] private string $title = ''; /** - * @var Collection - * - * @ORM\ManyToMany(targetEntity=User::class) - * - * @ORM\JoinTable(name="chill_main_notification_addresses_unread") + * @var Collection */ + #[ORM\ManyToMany(targetEntity: User::class)] + #[ORM\JoinTable(name: 'chill_main_notification_addresses_unread')] private Collection $unreadBy; - /** - * @ORM\Column(type="datetime_immutable") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)] private ?\DateTimeImmutable $updatedAt = null; - /** - * @ORM\ManyToOne(targetEntity=User::class) - */ + #[ORM\ManyToOne(targetEntity: User::class)] private ?User $updatedBy = null; public function __construct() @@ -187,10 +147,9 @@ class Notification implements TrackUpdateInterface } /** - * @Assert\Callback - * * @param array $payload */ + #[Assert\Callback] public function assertCountAddresses(ExecutionContextInterface $context, $payload): void { if (0 === (\count($this->getAddressesEmails()) + \count($this->getAddressees()))) { @@ -314,9 +273,7 @@ class Notification implements TrackUpdateInterface return $this->addUnreadBy($user); } - /** - * @ORM\PreFlush - */ + #[ORM\PreFlush] public function registerUnread() { foreach ($this->addedAddresses as $addressee) { diff --git a/src/Bundle/ChillMainBundle/Entity/NotificationComment.php b/src/Bundle/ChillMainBundle/Entity/NotificationComment.php index 49d1e859d..53d3fba2f 100644 --- a/src/Bundle/ChillMainBundle/Entity/NotificationComment.php +++ b/src/Bundle/ChillMainBundle/Entity/NotificationComment.php @@ -18,48 +18,29 @@ use Doctrine\ORM\Event\PrePersistEventArgs; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Entity - * - * @ORM\Table("chill_main_notification_comment") - * - * @ORM\HasLifecycleCallbacks - */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table('chill_main_notification_comment')] class NotificationComment implements TrackCreationInterface, TrackUpdateInterface { - /** - * @ORM\Column(type="text") - * - * @Assert\NotBlank(message="notification.Comment content might not be blank") - */ + #[Assert\NotBlank(message: 'notification.Comment content might not be blank')] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] private string $content = ''; - /** - * @ORM\Column(type="datetime_immutable", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)] private ?\DateTimeImmutable $createdAt = null; - /** - * @ORM\ManyToOne(targetEntity=User::class) - * - * @ORM\JoinColumn(nullable=true) - */ + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(nullable: true)] private ?User $createdBy = null; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity=Notification::class, inversedBy="comments") - * - * @ORM\JoinColumn(nullable=false) - */ + #[ORM\ManyToOne(targetEntity: Notification::class, inversedBy: 'comments')] + #[ORM\JoinColumn(nullable: false)] private ?Notification $notification = null; /** @@ -71,16 +52,12 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac /** * TODO typo in property (hotfixed). - * - * @ORM\Column(type="datetime_immutable", nullable=true) */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)] private ?\DateTimeImmutable $updateAt = null; - /** - * @ORM\ManyToOne(targetEntity=User::class) - * - * @ORM\JoinColumn(nullable=true) - */ + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(nullable: true)] private ?User $updatedBy = null; public function getContent(): string @@ -118,9 +95,7 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac return $this->updatedBy; } - /** - * @ORM\PreFlush - */ + #[ORM\PreFlush] public function onFlushMarkNotificationAsUnread(PreFlushEventArgs $eventArgs): void { if ($this->recentlyPersisted) { @@ -136,9 +111,7 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac } } - /** - * @ORM\PrePersist - */ + #[ORM\PrePersist] public function onPrePersist(PrePersistEventArgs $eventArgs): void { $this->recentlyPersisted = true; diff --git a/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php b/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php index 4a28267cd..4902fca95 100644 --- a/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php +++ b/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php @@ -16,56 +16,36 @@ use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Context\ExecutionContextInterface; -/** - * @ORM\Entity - * - * @ORM\Table(name="permission_groups") - * - * @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region") - */ +#[ORM\Entity] +#[ORM\Cache(usage: 'NONSTRICT_READ_WRITE', region: 'acl_cache_region')] +#[ORM\Table(name: 'permission_groups')] class PermissionsGroup { /** * @var string[] - * - * @ORM\Column(type="json") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array $flags = []; /** - * @var Collection - * - * @ORM\OneToMany( - * targetEntity="Chill\MainBundle\Entity\GroupCenter", - * mappedBy="permissionsGroup" - * ) + * @var Collection */ + #[ORM\OneToMany(mappedBy: 'permissionsGroup', targetEntity: GroupCenter::class)] private Collection $groupCenters; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; - /** - * @ORM\Column(type="string", length=255, nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: false, options: ['default' => ''])] private string $name = ''; /** - * @var Collection - * - * @ORM\ManyToMany( - * targetEntity="Chill\MainBundle\Entity\RoleScope", - * inversedBy="permissionsGroups", - * cascade={ "persist" }) - * - * @ORM\Cache(usage="NONSTRICT_READ_WRITE") + * @var Collection */ + #[ORM\ManyToMany(targetEntity: RoleScope::class, inversedBy: 'permissionsGroups', cascade: ['persist'])] + #[ORM\Cache(usage: 'NONSTRICT_READ_WRITE')] private Collection $roleScopes; /** @@ -157,7 +137,7 @@ class PermissionsGroup /** * @return $this */ - public function setName($name) + public function setName(string $name) { $this->name = $name; diff --git a/src/Bundle/ChillMainBundle/Entity/PostalCode.php b/src/Bundle/ChillMainBundle/Entity/PostalCode.php index 4d906d6c8..ecab19a5f 100644 --- a/src/Bundle/ChillMainBundle/Entity/PostalCode.php +++ b/src/Bundle/ChillMainBundle/Entity/PostalCode.php @@ -21,24 +21,16 @@ use Symfony\Component\Serializer\Annotation\Groups; /** * PostalCode. - * - * @ORM\Entity - * - * @ORM\Table( - * name="chill_main_postal_code", - * uniqueConstraints={ - * - * @ORM\UniqueConstraint(name="postal_code_import_unicity", columns={"code", "refpostalcodeid", "postalcodesource"}, - * options={"where": "refpostalcodeid is not null"}) - * }, - * indexes={ - * - * @ORM\Index(name="search_name_code", columns={"code", "label"}), - * @ORM\Index(name="search_by_reference_code", columns={"code", "refpostalcodeid"}) - * }) - * - * @ORM\HasLifecycleCallbacks */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'chill_main_postal_code')] +#[ORM\Index(name: 'search_name_code', columns: ['code', 'label'])] +#[ORM\Index(name: 'search_by_reference_code', columns: ['code', 'refpostalcodeid'])] +#[ORM\UniqueConstraint(name: 'postal_code_import_unicity', columns: ['code', 'refpostalcodeid', 'postalcodesource'], options: ['where' => 'refpostalcodeid is not null'])] +#[ORM\UniqueConstraint(name: 'postal_code_import_unicity', columns: ['code', 'refpostalcodeid', 'postalcodesource'], options: ['where' => 'refpostalcodeid is not null'])] // , +#[ORM\Index(name: 'search_name_code', columns: ['code', 'label'])] // , +#[ORM\Index(name: 'search_by_reference_code', columns: ['code', 'refpostalcodeid'])] class PostalCode implements TrackUpdateInterface, TrackCreationInterface { use TrackCreationTrait; @@ -49,74 +41,45 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface * This is an internal column which is populated by database. * * This column will ease the search operations - * - * @ORM\Column(type="text", options={"default": ""}) */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''])] private string $canonical = ''; - /** - * @ORM\Column(type="point", nullable=true) - * - * @groups({"read"}) - */ + #[Groups(['read'])] + #[ORM\Column(type: 'point', nullable: true)] private ?Point $center = null; - /** - * @ORM\Column(type="string", length=100) - * - * @groups({"write", "read"}) - */ + #[Groups(['write', 'read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 100)] private ?string $code = null; - /** - * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Country") - * - * @groups({"write", "read"}) - */ + #[Groups(['write', 'read'])] + #[ORM\ManyToOne(targetEntity: Country::class)] private ?Country $country = null; - /** - * @ORM\Column(type="datetime_immutable", nullable=true, options={"default": null}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true, options: ['default' => null])] private ?\DateTimeImmutable $deletedAt = null; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - * - * @groups({"write", "read"}) - */ + #[Groups(['write', 'read'])] + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; - /** - * @ORM\Column(type="string", length=255, name="label") - * - * @groups({"write", "read"}) - */ + #[Groups(['write', 'read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, name: 'label')] private ?string $name = null; - /** - * @ORM\Column(name="origin", type="integer", nullable=true) - * - * @groups({"write", "read"}) - */ + #[Groups(['write', 'read'])] + #[ORM\Column(name: 'origin', type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true)] private int $origin = 0; - /** - * @ORM\Column(type="string", length=255, nullable=true) - * - * @groups({"read"}) - */ + #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] private ?string $postalCodeSource = null; - /** - * @ORM\Column(type="string", length=255, nullable=true) - * - * @groups({"read"}) - */ + #[Groups(['read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] private ?string $refPostalCodeId = null; public function getCenter(): ?Point @@ -194,11 +157,9 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface /** * Set code. * - * @param string $code - * * @return PostalCode */ - public function setCode($code) + public function setCode(?string $code) { $this->code = $code; @@ -220,11 +181,9 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface /** * Set name. * - * @param string $name - * * @return PostalCode */ - public function setName($name) + public function setName(?string $name) { $this->name = $name; @@ -234,11 +193,9 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface /** * Set origin. * - * @param int $origin - * * @return PostalCode */ - public function setOrigin($origin) + public function setOrigin(int $origin) { $this->origin = $origin; diff --git a/src/Bundle/ChillMainBundle/Entity/Regroupment.php b/src/Bundle/ChillMainBundle/Entity/Regroupment.php index 4945a62c7..389eceb31 100644 --- a/src/Bundle/ChillMainBundle/Entity/Regroupment.php +++ b/src/Bundle/ChillMainBundle/Entity/Regroupment.php @@ -15,42 +15,26 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - * - * @ORM\Table(name="regroupment") - */ +#[ORM\Entity] +#[ORM\Table(name: 'regroupment')] class Regroupment { /** - * @ORM\ManyToMany( - * targetEntity=Center::class, - * inversedBy="regroupments" - * ) - * - * @ORM\Id - * - * @var Collection
+ * @var Collection */ + #[ORM\ManyToMany(targetEntity: Center::class, inversedBy: 'regroupments')] + #[ORM\Id] private Collection $centers; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $isActive = true; - /** - * @ORM\Column(type="text", options={"default": ""}, nullable=false) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''], nullable: false)] private string $name = ''; public function __construct() diff --git a/src/Bundle/ChillMainBundle/Entity/RoleScope.php b/src/Bundle/ChillMainBundle/Entity/RoleScope.php index 4777505f5..4048debb1 100644 --- a/src/Bundle/ChillMainBundle/Entity/RoleScope.php +++ b/src/Bundle/ChillMainBundle/Entity/RoleScope.php @@ -15,47 +15,28 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - * - * @ORM\Table(name="role_scopes") - * - * @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region") - */ +#[ORM\Entity] +#[ORM\Cache(usage: 'NONSTRICT_READ_WRITE', region: 'acl_cache_region')] +#[ORM\Table(name: 'role_scopes')] class RoleScope { - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; /** - * @var Collection - * - * @ORM\ManyToMany( - * targetEntity="Chill\MainBundle\Entity\PermissionsGroup", - * mappedBy="roleScopes") + * @var Collection */ + #[ORM\ManyToMany(targetEntity: PermissionsGroup::class, mappedBy: 'roleScopes')] private Collection $permissionsGroups; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] private ?string $role = null; - /** - * @ORM\ManyToOne( - * targetEntity="Chill\MainBundle\Entity\Scope", - * inversedBy="roleScopes") - * - * @ORM\JoinColumn(nullable=true, name="scope_id") - * - * @ORM\Cache(usage="NONSTRICT_READ_WRITE") - */ + #[ORM\ManyToOne(targetEntity: Scope::class, inversedBy: 'roleScopes')] + #[ORM\JoinColumn(nullable: true, name: 'scope_id')] + #[ORM\Cache(usage: 'NONSTRICT_READ_WRITE')] private ?Scope $scope = null; public function __construct() diff --git a/src/Bundle/ChillMainBundle/Entity/SavedExport.php b/src/Bundle/ChillMainBundle/Entity/SavedExport.php index 224423783..eec6b83e4 100644 --- a/src/Bundle/ChillMainBundle/Entity/SavedExport.php +++ b/src/Bundle/ChillMainBundle/Entity/SavedExport.php @@ -20,53 +20,34 @@ use Ramsey\Uuid\Uuid; use Ramsey\Uuid\UuidInterface; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Entity - * - * @ORM\Table(name="chill_main_saved_export") - */ +#[ORM\Entity] +#[ORM\Table(name: 'chill_main_saved_export')] class SavedExport implements TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; use TrackUpdateTrait; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Assert\NotBlank - */ + #[Assert\NotBlank] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $description = ''; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $exportAlias; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="uuid", unique="true") - * - * @ORM\GeneratedValue(strategy="NONE") - */ + #[ORM\Id] + #[ORM\Column(name: 'id', type: 'uuid', unique: true)] + #[ORM\GeneratedValue(strategy: 'NONE')] private UuidInterface $id; - /** - * @ORM\Column(type="json", nullable=false, options={"default": "[]"}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: false, options: ['default' => '[]'])] private array $options = []; - /** - * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Assert\NotBlank - */ + #[Assert\NotBlank] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $title = ''; - /** - * @ORM\ManyToOne(targetEntity=User::class) - */ + #[ORM\ManyToOne(targetEntity: User::class)] private User $user; public function __construct() diff --git a/src/Bundle/ChillMainBundle/Entity/Scope.php b/src/Bundle/ChillMainBundle/Entity/Scope.php index 464d60488..dd04f8a47 100644 --- a/src/Bundle/ChillMainBundle/Entity/Scope.php +++ b/src/Bundle/ChillMainBundle/Entity/Scope.php @@ -18,55 +18,34 @@ use Symfony\Component\Serializer\Annotation\Context; use Symfony\Component\Serializer\Annotation\DiscriminatorMap; use Symfony\Component\Serializer\Annotation\Groups; -/** - * @ORM\Entity - * - * @ORM\Table(name="scopes") - * - * @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region") - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "scope": Scope::class - * }) - */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['scope' => Scope::class])] +#[ORM\Entity] +#[ORM\Cache(usage: 'NONSTRICT_READ_WRITE', region: 'acl_cache_region')] +#[ORM\Table(name: 'scopes')] class Scope { - /** - * @ORM\Column(type="boolean", nullable=false, options={"default": true}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: false, options: ['default' => true])] private bool $active = true; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - * - * @Groups({"read", "docgen:read"}) - */ + #[Groups(['read', 'docgen:read'])] + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; /** * translatable names. - * - * @ORM\Column(type="json") - * - * @Groups({"read", "docgen:read"}) - * - * @Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] + #[Context(['is-translatable' => true], groups: ['docgen:read'])] private array $name = []; /** - * @var Collection - * - * @ORM\OneToMany( - * targetEntity="Chill\MainBundle\Entity\RoleScope", - * mappedBy="scope") - * - * @ORM\Cache(usage="NONSTRICT_READ_WRITE") + * @var Collection */ + #[ORM\OneToMany(mappedBy: 'scope', targetEntity: RoleScope::class)] + #[ORM\Cache(usage: 'NONSTRICT_READ_WRITE')] private Collection $roleScopes; /** diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index b94d90760..0c8c87553 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -19,6 +19,7 @@ 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\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Validator\Context\ExecutionContextInterface; @@ -26,150 +27,93 @@ use Chill\MainBundle\Validation\Constraint\PhonenumberConstraint; /** * User. - * - * @ORM\Entity - * - * @ORM\Table(name="users") - * - * @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region") - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "user": User::class - * }) */ -class User implements UserInterface, \Stringable +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['user' => User::class])] +#[ORM\Entity] +#[ORM\Cache(usage: 'NONSTRICT_READ_WRITE', region: 'acl_cache_region')] +#[ORM\Table(name: 'users')] +class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInterface { - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] protected ?int $id = null; - /** - * @ORM\Column(type="datetime_immutable", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)] private ?\DateTimeImmutable $absenceStart = null; /** * Array where SAML attributes's data are stored. - * - * @ORM\Column(type="json", nullable=false) */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: false)] private array $attributes = []; - /** - * @ORM\ManyToOne(targetEntity=Civility::class) - */ + #[ORM\ManyToOne(targetEntity: Civility::class)] private ?Civility $civility = null; - /** - * @ORM\ManyToOne(targetEntity=Location::class) - */ + #[ORM\ManyToOne(targetEntity: Location::class)] private ?Location $currentLocation = null; - /** - * @ORM\Column(type="string", length=150, nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 150, nullable: true)] private ?string $email = null; - /** - * @ORM\Column( - * type="string", - * length=150, - * nullable=true, - * unique=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 150, nullable: true, unique: true)] private ?string $emailCanonical = null; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] private bool $enabled = true; /** - * @var Collection - * - * @ORM\ManyToMany( - * targetEntity="Chill\MainBundle\Entity\GroupCenter", - * inversedBy="users") - * - * @ORM\Cache(usage="NONSTRICT_READ_WRITE") + * @var Collection */ + #[ORM\ManyToMany(targetEntity: GroupCenter::class, inversedBy: 'users')] + #[ORM\Cache(usage: 'NONSTRICT_READ_WRITE')] private Collection $groupCenters; - /** - * @ORM\Column(type="string", length=200) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 200)] private string $label = ''; - /** - * @ORM\Column(type="boolean") - * sf4 check: in yml was false by default !? - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] // sf4 check: in yml was false by default !? private bool $locked = true; - /** - * @ORM\ManyToOne(targetEntity=Center::class) - */ + #[ORM\ManyToOne(targetEntity: Center::class)] private ?Center $mainCenter = null; - /** - * @ORM\ManyToOne(targetEntity=Location::class) - */ + #[ORM\ManyToOne(targetEntity: Location::class)] private ?Location $mainLocation = null; /** - * @var Collection&Selectable - * - * @ORM\OneToMany(targetEntity=UserScopeHistory::class, - * mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true) + * @var \Doctrine\Common\Collections\Collection&Selectable */ + #[ORM\OneToMany(mappedBy: 'user', targetEntity: UserScopeHistory::class, cascade: ['persist', 'remove'], orphanRemoval: true)] private Collection&Selectable $scopeHistories; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] private string $password = ''; /** * @internal must be set to null if we use bcrypt - * - * @ORM\Column(type="string", length=255, nullable=true) */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] private ?string $salt = null; /** - * @var Collection&Selectable - * - * @ORM\OneToMany(targetEntity=UserJobHistory::class, - * mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true) + * @var \Doctrine\Common\Collections\Collection&Selectable */ + #[ORM\OneToMany(mappedBy: 'user', targetEntity: UserJobHistory::class, cascade: ['persist', 'remove'], orphanRemoval: true)] private Collection&Selectable $jobHistories; - /** - * @ORM\Column(type="string", length=80) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 80)] private string $username = ''; - /** - * @ORM\Column( - * type="string", - * length=80, - * unique=true, - * nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 80, unique: true, nullable: true)] private ?string $usernameCanonical = null; /** * The user's mobile phone number. - * - * @ORM\Column(type="phone_number", nullable=true) - * - * @PhonenumberConstraint() */ + #[ORM\Column(type: 'phone_number', nullable: true)] + #[PhonenumberConstraint] private ?PhoneNumber $phonenumber = null; /** @@ -197,9 +141,7 @@ class User implements UserInterface, \Stringable return $this; } - public function eraseCredentials() - { - } + public function eraseCredentials() {} public function getAbsenceStart(): ?\DateTimeImmutable { @@ -308,10 +250,7 @@ class User implements UserInterface, \Stringable return new ArrayCollection($sortedScopeHistories); } - /** - * @return string - */ - public function getPassword() + public function getPassword(): ?string { return $this->password; } @@ -373,6 +312,11 @@ class User implements UserInterface, \Stringable return $this->username; } + public function getUserIdentifier(): string + { + return $this->username; + } + /** * @return string */ @@ -493,7 +437,7 @@ class User implements UserInterface, \Stringable /** * @return $this */ - public function setEmail($email) + public function setEmail(?string $email) { $this->email = $email; @@ -503,7 +447,7 @@ class User implements UserInterface, \Stringable /** * @return $this */ - public function setEmailCanonical($emailCanonical) + public function setEmailCanonical(?string $emailCanonical) { $this->emailCanonical = $emailCanonical; @@ -554,7 +498,7 @@ class User implements UserInterface, \Stringable $this->scopeHistories[] = $newScope; $criteria = new Criteria(); - $criteria->orderBy(['startDate' => \Doctrine\Common\Collections\Order::Ascending, 'id' => \Doctrine\Common\Collections\Order::Ascending]); + $criteria->orderBy(['startDate' => 'ASC', 'id' => 'ASC']); /** @var \Iterator $scopes */ $scopes = $this->scopeHistories->matching($criteria)->getIterator(); @@ -577,7 +521,7 @@ class User implements UserInterface, \Stringable /** * @return $this */ - public function setPassword($password) + public function setPassword(string $password) { $this->password = $password; @@ -587,7 +531,7 @@ class User implements UserInterface, \Stringable /** * @return $this */ - public function setSalt($salt) + public function setSalt(?string $salt) { $this->salt = $salt; @@ -649,7 +593,7 @@ class User implements UserInterface, \Stringable /** * @return $this */ - public function setUsernameCanonical($usernameCanonical) + public function setUsernameCanonical(?string $usernameCanonical) { $this->usernameCanonical = $usernameCanonical; diff --git a/src/Bundle/ChillMainBundle/Entity/User/UserJobHistory.php b/src/Bundle/ChillMainBundle/Entity/User/UserJobHistory.php index 7916d9891..4437b7356 100644 --- a/src/Bundle/ChillMainBundle/Entity/User/UserJobHistory.php +++ b/src/Bundle/ChillMainBundle/Entity/User/UserJobHistory.php @@ -11,45 +11,29 @@ declare(strict_types=1); namespace Chill\MainBundle\Entity\User; -use App\Repository\UserJobHistoryRepository; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\UserJob; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table(name="chill_main_user_job_history") - * - * @ORM\Entity(repositoryClass=UserJobHistoryRepository::class) - */ +#[ORM\Entity(repositoryClass: \Chill\MainBundle\Repository\User\UserJobHistoryRepository::class)] +#[ORM\Table(name: 'chill_main_user_job_history')] class UserJobHistory { - /** - * @ORM\Column(type="datetime_immutable", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)] private ?\DateTimeImmutable $endDate = null; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity=UserJob::class) - */ + #[ORM\ManyToOne(targetEntity: UserJob::class)] private ?UserJob $job = null; - /** - * @ORM\Column(type="datetime_immutable") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)] private \DateTimeImmutable $startDate; - /** - * @ORM\ManyToOne(targetEntity=User::class) - */ + #[ORM\ManyToOne(targetEntity: User::class)] private User $user; public function getEndDate(): ?\DateTimeImmutable diff --git a/src/Bundle/ChillMainBundle/Entity/User/UserScopeHistory.php b/src/Bundle/ChillMainBundle/Entity/User/UserScopeHistory.php index 6ac768de2..64ecbfd64 100644 --- a/src/Bundle/ChillMainBundle/Entity/User/UserScopeHistory.php +++ b/src/Bundle/ChillMainBundle/Entity/User/UserScopeHistory.php @@ -11,45 +11,30 @@ declare(strict_types=1); namespace Chill\MainBundle\Entity\User; -use App\Repository\UserScopeHistoryRepository; use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Entity\User; +use Chill\MainBundle\Repository\User\UserScopeHistoryRepository; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Table(name="chill_main_user_scope_history") - * - * @ORM\Entity(repositoryClass=UserScopeHistoryRepository::class) - */ +#[ORM\Entity(repositoryClass: UserScopeHistoryRepository::class)] +#[ORM\Table(name: 'chill_main_user_scope_history')] class UserScopeHistory { - /** - * @ORM\Column(type="datetime_immutable", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)] private ?\DateTimeImmutable $endDate = null; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\ManyToOne(targetEntity=Scope::class) - */ + #[ORM\ManyToOne(targetEntity: Scope::class)] private ?Scope $scope = null; - /** - * @ORM\Column(type="datetime_immutable") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)] private \DateTimeImmutable $startDate; - /** - * @ORM\ManyToOne(targetEntity=User::class) - */ + #[ORM\ManyToOne(targetEntity: User::class)] private User $user; public function getEndDate(): ?\DateTimeImmutable diff --git a/src/Bundle/ChillMainBundle/Entity/UserJob.php b/src/Bundle/ChillMainBundle/Entity/UserJob.php index 6be1a5efe..2efb85e34 100644 --- a/src/Bundle/ChillMainBundle/Entity/UserJob.php +++ b/src/Bundle/ChillMainBundle/Entity/UserJob.php @@ -14,42 +14,26 @@ namespace Chill\MainBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation as Serializer; -/** - * @ORM\Entity - * - * @ORM\Table("chill_main_user_job") - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "user_job": UserJob::class - * }) - */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['user_job' => UserJob::class])] +#[ORM\Entity] +#[ORM\Table('chill_main_user_job')] class UserJob { - /** - * @ORM\Column(name="active", type="boolean") - */ + #[ORM\Column(name: 'active', type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $active = true; - /** - * @ORM\Id - * - * @ORM\Column(name="id", type="integer") - * - * @ORM\GeneratedValue(strategy="AUTO") - * - * @Serializer\Groups({"read", "docgen:read"}) - */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[ORM\Id] + #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue(strategy: 'AUTO')] protected ?int $id = null; /** * @var array - * - * @ORM\Column(name="label", type="json") - * - * @Serializer\Groups({"read", "docgen:read"}) - * - * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[ORM\Column(name: 'label', type: \Doctrine\DBAL\Types\Types::JSON)] + #[Serializer\Context(['is-translatable' => true], groups: ['docgen:read'])] protected array $label = []; public function getId(): ?int diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php index e26547428..460db387d 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php @@ -19,21 +19,15 @@ use Chill\MainBundle\Entity\User; use Chill\MainBundle\Workflow\Validator\EntityWorkflowCreation; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; +use Doctrine\Common\Collections\Order; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Entity - * - * @ORM\Table("chill_main_workflow_entity") - * - * @EntityWorkflowCreation(groups={"creation"}) - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "entity_workflow": EntityWorkflow::class - * }) - */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['entity_workflow' => EntityWorkflow::class])] +#[ORM\Entity] +#[ORM\Table('chill_main_workflow_entity')] +#[EntityWorkflowCreation(groups: ['creation'])] class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; @@ -70,40 +64,28 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface public array $futureDestUsers = []; /** - * @ORM\OneToMany(targetEntity=EntityWorkflowComment::class, mappedBy="entityWorkflow", orphanRemoval=true) - * - * @var Collection + * @var Collection */ + #[ORM\OneToMany(targetEntity: EntityWorkflowComment::class, mappedBy: 'entityWorkflow', orphanRemoval: true)] private Collection $comments; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="string", length=255) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] private string $relatedEntityClass = ''; - /** - * @ORM\Column(type="integer") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private int $relatedEntityId; /** - * @ORM\OneToMany(targetEntity=EntityWorkflowStep::class, mappedBy="entityWorkflow", orphanRemoval=true, cascade={"persist"}) - * - * @ORM\OrderBy({"transitionAt": "ASC", "id": "ASC"}) - * - * @Assert\Valid(traverse=true) - * - * @var Collection + * @var Collection */ + #[Assert\Valid(traverse: true)] + #[ORM\OneToMany(mappedBy: 'entityWorkflow', targetEntity: EntityWorkflowStep::class, cascade: ['persist'], orphanRemoval: true)] + #[ORM\OrderBy(['transitionAt' => \Doctrine\Common\Collections\Criteria::ASC, 'id' => 'ASC'])] private Collection $steps; /** @@ -112,21 +94,17 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface private ?array $stepsChainedCache = null; /** - * @ORM\ManyToMany(targetEntity=User::class) - * - * @ORM\JoinTable(name="chill_main_workflow_entity_subscriber_to_final") - * - * @var Collection + * @var Collection */ + #[ORM\ManyToMany(targetEntity: User::class)] + #[ORM\JoinTable(name: 'chill_main_workflow_entity_subscriber_to_final')] private Collection $subscriberToFinal; /** - * @ORM\ManyToMany(targetEntity=User::class) - * - * @ORM\JoinTable(name="chill_main_workflow_entity_subscriber_to_step") - * - * @var Collection + * @var Collection */ + #[ORM\ManyToMany(targetEntity: User::class)] + #[ORM\JoinTable(name: 'chill_main_workflow_entity_subscriber_to_step')] private Collection $subscriberToStep; /** @@ -134,9 +112,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface */ private ?EntityWorkflowStep $transitionningStep = null; - /** - * @ORM\Column(type="text") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] private string $workflowName; public function __construct() @@ -300,12 +276,16 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface return $this->steps; } + /** + * @throws \Exception + */ public function getStepsChained(): array { if (\is_array($this->stepsChainedCache)) { return $this->stepsChainedCache; } + /** @var \ArrayIterator $iterator */ $iterator = $this->steps->getIterator(); $current = null; $steps = []; diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowComment.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowComment.php index 9b02bbb9e..2943e5cff 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowComment.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowComment.php @@ -17,34 +17,23 @@ use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface; use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity - * - * @ORM\Table("chill_main_workflow_entity_comment") - */ +#[ORM\Entity] +#[ORM\Table('chill_main_workflow_entity_comment')] class EntityWorkflowComment implements TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; use TrackUpdateTrait; - /** - * @ORM\Column(type="text", options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''])] private string $comment = ''; - /** - * @ORM\ManyToOne(targetEntity=EntityWorkflow::class, inversedBy="comments") - */ + #[ORM\ManyToOne(targetEntity: EntityWorkflow::class, inversedBy: 'comments')] private ?EntityWorkflow $entityWorkflow = null; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; public function getComment(): string diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php index 53e4ad945..de2a32fd7 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php @@ -18,82 +18,55 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Context\ExecutionContextInterface; -/** - * @ORM\Entity - * - * @ORM\Table("chill_main_workflow_entity_step") - */ +#[ORM\Entity] +#[ORM\Table('chill_main_workflow_entity_step')] class EntityWorkflowStep { - /** - * @ORM\Column(type="text", nullable=false) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false)] private string $accessKey; /** - * @var Collection - * - * @ORM\ManyToMany(targetEntity=User::class) - * - * @ORM\JoinTable(name="chill_main_workflow_entity_step_cc_user") + * @var Collection */ + #[ORM\ManyToMany(targetEntity: User::class)] + #[ORM\JoinTable(name: 'chill_main_workflow_entity_step_cc_user')] private Collection $ccUser; - /** - * @ORM\Column(type="text", options={"default": ""}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''])] private string $comment = ''; - /** - * @ORM\Column(type="text") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] private ?string $currentStep = ''; - /** - * @ORM\Column(type="json") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array $destEmail = []; /** - * @var Collection - * - * @ORM\ManyToMany(targetEntity=User::class) - * - * @ORM\JoinTable(name="chill_main_workflow_entity_step_user") + * @var Collection */ + #[ORM\ManyToMany(targetEntity: User::class)] + #[ORM\JoinTable(name: 'chill_main_workflow_entity_step_user')] private Collection $destUser; /** - * @var Collection - * - * @ORM\ManyToMany(targetEntity=User::class) - * - * @ORM\JoinTable(name="chill_main_workflow_entity_step_user_by_accesskey") + * @var Collection */ + #[ORM\ManyToMany(targetEntity: User::class)] + #[ORM\JoinTable(name: 'chill_main_workflow_entity_step_user_by_accesskey')] private Collection $destUserByAccessKey; - /** - * @ORM\ManyToOne(targetEntity=EntityWorkflow::class, inversedBy="steps") - */ + #[ORM\ManyToOne(targetEntity: EntityWorkflow::class, inversedBy: 'steps')] private ?EntityWorkflow $entityWorkflow = null; - /** - * @ORM\Column(type="boolean", options={"default": false}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])] private bool $freezeAfter = false; - /** - * @ORM\Id - * - * @ORM\GeneratedValue - * - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] private ?int $id = null; - /** - * @ORM\Column(type="boolean", options={"default": false}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])] private bool $isFinal = false; /** @@ -106,26 +79,17 @@ class EntityWorkflowStep */ private ?EntityWorkflowStep $previous = null; - /** - * @ORM\Column(type="text", nullable=true, options={"default": null}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true, options: ['default' => null])] private ?string $transitionAfter = null; - /** - * @ORM\Column(type="datetime_immutable", nullable=true, options={"default": null}) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true, options: ['default' => null])] private ?\DateTimeImmutable $transitionAt = null; - /** - * @ORM\ManyToOne(targetEntity=User::class) - * - * @ORM\JoinColumn(nullable=true) - */ + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(nullable: true)] private ?User $transitionBy = null; - /** - * @ORM\Column(type="text", nullable=true) - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)] private ?string $transitionByEmail = null; public function __construct() @@ -413,9 +377,7 @@ class EntityWorkflowStep return $this; } - /** - * @Assert\Callback - */ + #[Assert\Callback] public function validateOnCreation(ExecutionContextInterface $context, mixed $payload): void { return; diff --git a/src/Bundle/ChillMainBundle/Export/ExportFormHelper.php b/src/Bundle/ChillMainBundle/Export/ExportFormHelper.php index 61ff268c4..ce43c230a 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportFormHelper.php +++ b/src/Bundle/ChillMainBundle/Export/ExportFormHelper.php @@ -26,8 +26,7 @@ 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/Helper/DateTimeHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php index 3be1af08a..0fad30b4f 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php @@ -15,9 +15,7 @@ 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 07a4f9f88..9161316e7 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/ExportAddressHelper.php @@ -79,9 +79,7 @@ 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 fc19f7466..1b561390a 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/TranslatableStringExportLabelHelper.php @@ -21,9 +21,7 @@ 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 36b126df9..ee164b93c 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/UserHelper.php @@ -16,9 +16,7 @@ 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. diff --git a/src/Bundle/ChillMainBundle/Export/ListInterface.php b/src/Bundle/ChillMainBundle/Export/ListInterface.php index 53442f0e7..9b88525ca 100644 --- a/src/Bundle/ChillMainBundle/Export/ListInterface.php +++ b/src/Bundle/ChillMainBundle/Export/ListInterface.php @@ -20,6 +20,4 @@ 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 0536f6569..6228109ed 100644 --- a/src/Bundle/ChillMainBundle/Export/SortExportElement.php +++ b/src/Bundle/ChillMainBundle/Export/SortExportElement.php @@ -17,8 +17,7 @@ final readonly class SortExportElement { public function __construct( private TranslatorInterface $translator, - ) { - } + ) {} /** * @param array $elements diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php index c88e2275b..a4cab4a9b 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php @@ -28,7 +28,7 @@ class AddressDataMapper implements DataMapperInterface * @param Address $address * @param \Iterator $forms */ - public function mapDataToForms($address, $forms) + public function mapDataToForms($address, \Traversable $forms) { if (null === $address) { return; @@ -78,7 +78,7 @@ class AddressDataMapper implements DataMapperInterface * @param \Iterator $forms * @param Address $address */ - public function mapFormsToData($forms, &$address) + public function mapFormsToData(\Traversable $forms, &$address) { if (!$address instanceof Address) { $address = new Address(); diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/ExportPickCenterDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/ExportPickCenterDataMapper.php index 73d048c1a..2a19c8e0b 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/ExportPickCenterDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/ExportPickCenterDataMapper.php @@ -17,7 +17,7 @@ use Symfony\Component\Form\FormInterface; final readonly class ExportPickCenterDataMapper implements DataMapperInterface { - public function mapDataToForms($viewData, $forms): void + public function mapDataToForms($viewData, \Traversable $forms): void { if (null === $viewData) { return; @@ -31,7 +31,7 @@ final readonly class ExportPickCenterDataMapper implements DataMapperInterface // NOTE: we do not map back the regroupments } - public function mapFormsToData($forms, &$viewData): void + public function mapFormsToData(\Traversable $forms, &$viewData): void { /** @var array $forms */ $forms = iterator_to_array($forms); diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php index 10f9c26e3..3f1284db8 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php @@ -19,11 +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) + public function mapDataToForms($viewData, \Traversable $forms) { if (null === $viewData) { return null; @@ -38,7 +36,7 @@ final class PrivateCommentDataMapper extends AbstractType implements DataMapperI $forms['comments']->setData($viewData->getCommentForUser($this->security->getUser())); } - public function mapFormsToData($forms, &$viewData) + public function mapFormsToData(\Traversable $forms, &$viewData) { $forms = iterator_to_array($forms); diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/RollingDateDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/RollingDateDataMapper.php index 6a139de7b..254860e64 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/RollingDateDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/RollingDateDataMapper.php @@ -17,7 +17,7 @@ use Symfony\Component\Form\Exception; class RollingDateDataMapper implements DataMapperInterface { - public function mapDataToForms($viewData, $forms) + public function mapDataToForms($viewData, \Traversable $forms) { if (null === $viewData) { return; @@ -33,7 +33,7 @@ class RollingDateDataMapper implements DataMapperInterface $forms['fixedDate']->setData($viewData->getFixedDate()); } - public function mapFormsToData($forms, &$viewData): void + public function mapFormsToData(\Traversable $forms, &$viewData): void { $forms = iterator_to_array($forms); diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php index 267927ff1..d6a0cea20 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php @@ -16,11 +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) + public function mapDataToForms($data, \Traversable $forms) { $forms = iterator_to_array($forms); @@ -39,7 +37,7 @@ class ScopePickerDataMapper implements DataMapperInterface } } - public function mapFormsToData($forms, &$data) + public function mapFormsToData(\Traversable $forms, &$data) { $forms = iterator_to_array($forms); diff --git a/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php b/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php index aba5e2bc4..42606ebd7 100644 --- a/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php +++ b/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php @@ -17,9 +17,7 @@ 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 e4748d850..7f61cccce 100644 --- a/src/Bundle/ChillMainBundle/Form/LocationFormType.php +++ b/src/Bundle/ChillMainBundle/Form/LocationFormType.php @@ -24,9 +24,7 @@ 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/DataTransformer/AddressToIdDataTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php index c04a4b158..04094537b 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php @@ -17,9 +17,7 @@ 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 9a8b0a6d7..d328d38f0 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php @@ -20,9 +20,7 @@ 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 bd54b0c09..d193ea2ef 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php @@ -22,9 +22,7 @@ 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 436b72ce3..808093278 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php @@ -17,9 +17,7 @@ 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 ffdee60bd..e56778bf2 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php @@ -17,9 +17,7 @@ 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 5f9117577..dde8b7b9e 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/PostalCodeToIdTransformer.php @@ -18,9 +18,7 @@ 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 cb5adec47..2779f2cdd 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php @@ -18,9 +18,7 @@ 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/DateIntervalType.php b/src/Bundle/ChillMainBundle/Form/Type/DateIntervalType.php index 7a70e7ca6..c9bc4dd82 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/DateIntervalType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/DateIntervalType.php @@ -55,7 +55,6 @@ class DateIntervalType extends AbstractType { $builder ->add('n', IntegerType::class, [ - 'scale' => 0, 'constraints' => [ new GreaterThan([ 'value' => 0, diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php index 930712084..e5d0887f3 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php @@ -29,9 +29,7 @@ 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 a968f4aa2..d4873df83 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php @@ -24,9 +24,7 @@ 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 6e4231580..fa8caf488 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php @@ -33,8 +33,7 @@ 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 8750ee006..190e09f30 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php @@ -41,9 +41,7 @@ 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 12b170a73..ba6cc874d 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php @@ -34,9 +34,7 @@ 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 abe190de5..f9aa09ce8 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickCivilityType.php @@ -21,9 +21,7 @@ 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 7fb50fd4a..8aa216da1 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickLocationTypeType.php @@ -19,9 +19,7 @@ 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 041176905..1a1ed4354 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickPostalCodeType.php @@ -21,9 +21,7 @@ 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/PickUserDynamicType.php b/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php index ad23e5655..aab9d4c51 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php @@ -27,9 +27,7 @@ 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 bea96b79b..9d1cdb626 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickUserLocationType.php @@ -20,9 +20,7 @@ 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 44354922f..0d26b5a95 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php @@ -21,9 +21,7 @@ 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 fd27a9bcb..6f10626c6 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php @@ -39,9 +39,11 @@ 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 370de1137..e9ff503df 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php @@ -26,9 +26,7 @@ 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) { diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php index 9d634857a..68a3970ba 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php @@ -26,9 +26,7 @@ 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) { diff --git a/src/Bundle/ChillMainBundle/Form/UserPasswordType.php b/src/Bundle/ChillMainBundle/Form/UserPasswordType.php index 5103e25c0..256e68731 100644 --- a/src/Bundle/ChillMainBundle/Form/UserPasswordType.php +++ b/src/Bundle/ChillMainBundle/Form/UserPasswordType.php @@ -17,7 +17,6 @@ use Symfony\Component\Form\Extension\Core\Type\PasswordType; use Symfony\Component\Form\Extension\Core\Type\RepeatedType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Symfony\Component\Validator\Constraints\Callback; use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotBlank; @@ -32,12 +31,12 @@ class UserPasswordType extends AbstractType protected $chillLogger; /** - * @var UserPasswordEncoderInterface + * @var \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface */ protected $passwordEncoder; public function __construct( - UserPasswordEncoderInterface $passwordEncoder, + \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder, LoggerInterface $chillLogger, ) { $this->passwordEncoder = $passwordEncoder; diff --git a/src/Bundle/ChillMainBundle/Form/UserType.php b/src/Bundle/ChillMainBundle/Form/UserType.php index 4a6bb8f9a..9d62fbc6a 100644 --- a/src/Bundle/ChillMainBundle/Form/UserType.php +++ b/src/Bundle/ChillMainBundle/Form/UserType.php @@ -36,9 +36,7 @@ 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) { diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php index f0360d4bb..3a3f1b8d3 100644 --- a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php +++ b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php @@ -34,9 +34,7 @@ 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) { diff --git a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php index e08543e8c..b61f38a35 100644 --- a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php +++ b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php @@ -24,9 +24,7 @@ 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 7eba06242..7b535f1a7 100644 --- a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php @@ -24,9 +24,7 @@ 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 fc2cd35ea..3268fee05 100644 --- a/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php +++ b/src/Bundle/ChillMainBundle/Notification/EventListener/PersistNotificationOnTerminateEventSubscriber.php @@ -18,9 +18,7 @@ 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() { @@ -33,7 +31,7 @@ class PersistNotificationOnTerminateEventSubscriber implements EventSubscriberIn public function onKernelTerminate(TerminateEvent $event): void { - if ($event->isMasterRequest()) { + if ($event->isMainRequest()) { $this->persistNotifications(); } } diff --git a/src/Bundle/ChillMainBundle/Notification/Exception/NotificationHandlerNotFound.php b/src/Bundle/ChillMainBundle/Notification/Exception/NotificationHandlerNotFound.php index a55104d23..b1acff57b 100644 --- a/src/Bundle/ChillMainBundle/Notification/Exception/NotificationHandlerNotFound.php +++ b/src/Bundle/ChillMainBundle/Notification/Exception/NotificationHandlerNotFound.php @@ -11,6 +11,4 @@ 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 3b3374d51..48adcd24f 100644 --- a/src/Bundle/ChillMainBundle/Notification/Mailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Mailer.php @@ -34,9 +34,7 @@ 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 04116a434..aa6e700bc 100644 --- a/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php +++ b/src/Bundle/ChillMainBundle/Notification/NotificationHandlerManager.php @@ -17,9 +17,7 @@ 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 9b606d18d..5c5cb3dcf 100644 --- a/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php +++ b/src/Bundle/ChillMainBundle/Notification/NotificationPresence.php @@ -23,9 +23,7 @@ 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 8dd2935dd..a65758f5f 100644 --- a/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php +++ b/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php @@ -21,9 +21,7 @@ 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 b887accaa..4c9cb68fe 100644 --- a/src/Bundle/ChillMainBundle/Pagination/PageGenerator.php +++ b/src/Bundle/ChillMainBundle/Pagination/PageGenerator.php @@ -18,9 +18,7 @@ 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 ee9f49805..b2500dfc2 100644 --- a/src/Bundle/ChillMainBundle/Pagination/Paginator.php +++ b/src/Bundle/ChillMainBundle/Pagination/Paginator.php @@ -57,8 +57,7 @@ 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 { diff --git a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php index 8956f2276..9a809287b 100644 --- a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php +++ b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php @@ -39,8 +39,7 @@ final readonly class PaginatorFactory implements PaginatorFactoryInterface * the request or inside the paginator. */ private int $itemPerPage = 20, - ) { - } + ) {} /** * create a paginator instance. diff --git a/src/Bundle/ChillMainBundle/Phonenumber/Templating.php b/src/Bundle/ChillMainBundle/Phonenumber/Templating.php index 69da56eca..51d57c9e9 100644 --- a/src/Bundle/ChillMainBundle/Phonenumber/Templating.php +++ b/src/Bundle/ChillMainBundle/Phonenumber/Templating.php @@ -16,9 +16,7 @@ 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 439bb3558..b9e454b46 100644 --- a/src/Bundle/ChillMainBundle/Redis/ChillRedis.php +++ b/src/Bundle/ChillMainBundle/Redis/ChillRedis.php @@ -16,6 +16,4 @@ use Redis; /** * Redis client configured by chill main. */ -class ChillRedis extends \Redis -{ -} +class ChillRedis extends \Redis {} diff --git a/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php b/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php index 86faf6ea1..3e8d060c3 100644 --- a/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/AddressReferenceRepository.php @@ -20,11 +20,11 @@ use Doctrine\ORM\Query\ResultSetMapping; use Doctrine\ORM\Query\ResultSetMappingBuilder; use Doctrine\Persistence\ObjectRepository; -final class AddressReferenceRepository implements ObjectRepository +final readonly class AddressReferenceRepository implements ObjectRepository { - private readonly EntityManagerInterface $entityManager; + private EntityManagerInterface $entityManager; - private readonly EntityRepository $repository; + private EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/AddressRepository.php b/src/Bundle/ChillMainBundle/Repository/AddressRepository.php index 074b1fc32..4dbd09cab 100644 --- a/src/Bundle/ChillMainBundle/Repository/AddressRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/AddressRepository.php @@ -17,9 +17,9 @@ use Doctrine\ORM\EntityRepository; use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ObjectRepository; -final class AddressRepository implements ObjectRepository +final readonly class AddressRepository implements ObjectRepository { - private readonly EntityRepository $repository; + private EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/CenterRepository.php b/src/Bundle/ChillMainBundle/Repository/CenterRepository.php index 0b507faa1..1bc5a7405 100644 --- a/src/Bundle/ChillMainBundle/Repository/CenterRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/CenterRepository.php @@ -15,9 +15,9 @@ use Chill\MainBundle\Entity\Center; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; -final class CenterRepository implements CenterRepositoryInterface +final readonly class CenterRepository implements CenterRepositoryInterface { - private readonly EntityRepository $repository; + private EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/CountryRepository.php b/src/Bundle/ChillMainBundle/Repository/CountryRepository.php index 701019dba..ae318e35e 100644 --- a/src/Bundle/ChillMainBundle/Repository/CountryRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/CountryRepository.php @@ -17,9 +17,9 @@ use Doctrine\ORM\EntityRepository; use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ObjectRepository; -final class CountryRepository implements ObjectRepository +final readonly class CountryRepository implements ObjectRepository { - private readonly EntityRepository $repository; + private EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/GeographicalUnitLayerLayerRepository.php b/src/Bundle/ChillMainBundle/Repository/GeographicalUnitLayerLayerRepository.php index 11a03c209..1135b889d 100644 --- a/src/Bundle/ChillMainBundle/Repository/GeographicalUnitLayerLayerRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/GeographicalUnitLayerLayerRepository.php @@ -15,9 +15,9 @@ use Chill\MainBundle\Entity\GeographicalUnitLayer; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; -final class GeographicalUnitLayerLayerRepository implements GeographicalUnitLayerRepositoryInterface +final readonly class GeographicalUnitLayerLayerRepository implements GeographicalUnitLayerRepositoryInterface { - private readonly EntityRepository $repository; + private EntityRepository $repository; public function __construct(EntityManagerInterface $em) { diff --git a/src/Bundle/ChillMainBundle/Repository/GeographicalUnitRepository.php b/src/Bundle/ChillMainBundle/Repository/GeographicalUnitRepository.php index 608609a11..35ec31ff3 100644 --- a/src/Bundle/ChillMainBundle/Repository/GeographicalUnitRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/GeographicalUnitRepository.php @@ -18,9 +18,9 @@ use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\QueryBuilder; -final class GeographicalUnitRepository implements GeographicalUnitRepositoryInterface +final readonly class GeographicalUnitRepository implements GeographicalUnitRepositoryInterface { - private readonly EntityRepository $repository; + private EntityRepository $repository; public function __construct(EntityManagerInterface $em) { diff --git a/src/Bundle/ChillMainBundle/Repository/GroupCenterRepository.php b/src/Bundle/ChillMainBundle/Repository/GroupCenterRepository.php index 2d9ad8c5a..d0f5d8561 100644 --- a/src/Bundle/ChillMainBundle/Repository/GroupCenterRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/GroupCenterRepository.php @@ -16,9 +16,9 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\Persistence\ObjectRepository; -final class GroupCenterRepository implements ObjectRepository +final readonly class GroupCenterRepository implements ObjectRepository { - private readonly EntityRepository $repository; + private EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/LanguageRepository.php b/src/Bundle/ChillMainBundle/Repository/LanguageRepository.php index d8c5d54f8..28d21d2c1 100644 --- a/src/Bundle/ChillMainBundle/Repository/LanguageRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/LanguageRepository.php @@ -15,9 +15,9 @@ use Chill\MainBundle\Entity\Language; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; -final class LanguageRepository implements LanguageRepositoryInterface +final readonly class LanguageRepository implements LanguageRepositoryInterface { - private readonly EntityRepository $repository; + private EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/PermissionsGroupRepository.php b/src/Bundle/ChillMainBundle/Repository/PermissionsGroupRepository.php index 910d924db..598894b61 100644 --- a/src/Bundle/ChillMainBundle/Repository/PermissionsGroupRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/PermissionsGroupRepository.php @@ -16,9 +16,9 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\Persistence\ObjectRepository; -final class PermissionsGroupRepository implements ObjectRepository +final readonly class PermissionsGroupRepository implements ObjectRepository { - private readonly EntityRepository $repository; + private EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/PostalCodeRepository.php b/src/Bundle/ChillMainBundle/Repository/PostalCodeRepository.php index 0949f52ba..0779ea90a 100644 --- a/src/Bundle/ChillMainBundle/Repository/PostalCodeRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/PostalCodeRepository.php @@ -19,11 +19,11 @@ use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Query\ResultSetMapping; use Doctrine\ORM\Query\ResultSetMappingBuilder; -final class PostalCodeRepository implements PostalCodeRepositoryInterface +final readonly class PostalCodeRepository implements PostalCodeRepositoryInterface { - private readonly EntityManagerInterface $entityManager; + private EntityManagerInterface $entityManager; - private readonly EntityRepository $repository; + private EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/RegroupmentRepository.php b/src/Bundle/ChillMainBundle/Repository/RegroupmentRepository.php index e18279944..793015f5b 100644 --- a/src/Bundle/ChillMainBundle/Repository/RegroupmentRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/RegroupmentRepository.php @@ -18,9 +18,9 @@ use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\NoResultException; use Doctrine\Persistence\ObjectRepository; -final class RegroupmentRepository implements ObjectRepository +final readonly class RegroupmentRepository implements ObjectRepository { - private readonly EntityRepository $repository; + private EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/RoleScopeRepository.php b/src/Bundle/ChillMainBundle/Repository/RoleScopeRepository.php index ddf52af5b..a00d2ce35 100644 --- a/src/Bundle/ChillMainBundle/Repository/RoleScopeRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/RoleScopeRepository.php @@ -16,9 +16,9 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\Persistence\ObjectRepository; -final class RoleScopeRepository implements ObjectRepository +final readonly class RoleScopeRepository implements ObjectRepository { - private readonly EntityRepository $repository; + private EntityRepository $repository; public function __construct(EntityManagerInterface $entityManager) { diff --git a/src/Bundle/ChillMainBundle/Repository/ScopeRepository.php b/src/Bundle/ChillMainBundle/Repository/ScopeRepository.php index aa3c78270..4f752bce0 100644 --- a/src/Bundle/ChillMainBundle/Repository/ScopeRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/ScopeRepository.php @@ -17,11 +17,11 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\QueryBuilder; -final class ScopeRepository implements ScopeRepositoryInterface +final readonly class ScopeRepository implements ScopeRepositoryInterface { - private readonly EntityRepository $repository; + private EntityRepository $repository; - public function __construct(EntityManagerInterface $entityManager, private readonly TranslatableStringHelperInterface $translatableStringHelper) + public function __construct(EntityManagerInterface $entityManager, private TranslatableStringHelperInterface $translatableStringHelper) { $this->repository = $entityManager->getRepository(Scope::class); } diff --git a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php index 5b830ce27..f14424f6f 100644 --- a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php @@ -19,9 +19,7 @@ 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/chill/js/date.ts b/src/Bundle/ChillMainBundle/Resources/public/chill/js/date.ts index 8c087146a..9198f835e 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/js/date.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/js/date.ts @@ -59,6 +59,10 @@ export const ISOToDatetime = (str: string|null): Date|null => { [hours, minutes, seconds] = time.split(':').map(s => parseInt(s)); ; + if ('0000' === timezone) { + return new Date(Date.UTC(year, month-1, date, hours, minutes, seconds)); + } + return new Date(year, month-1, date, hours, minutes, seconds); } diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/download-report/download-report.js b/src/Bundle/ChillMainBundle/Resources/public/lib/download-report/download-report.js index e7dce2d48..9251639a8 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/download-report/download-report.js +++ b/src/Bundle/ChillMainBundle/Resources/public/lib/download-report/download-report.js @@ -15,9 +15,9 @@ * along with this program. If not, see . */ -var mime = require('mime') +import mime from 'mime'; -var download_report = (url, container) => { +export const download_report = (url, container) => { var download_text = container.dataset.downloadText, alias = container.dataset.alias; @@ -70,5 +70,3 @@ var download_report = (url, container) => { .replaceChild(problem_text, container.firstChild); }); }; - -module.exports = download_report; diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/editor_config.ts similarity index 72% rename from src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.js rename to src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/editor_config.ts index ddbc4afa7..7a72c0ffa 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/editor_config.ts @@ -39,23 +39,5 @@ ClassicEditor.defaultConfig = { 'redo' ] }, - language: 'fr' + language: 'fr', }; - - -let Fields = []; -Fields.push.apply(Fields, document.querySelectorAll('textarea[ckeditor]')); -// enable for custom fields -//Fields.push.apply(Fields, document.querySelectorAll('.cf-fields textarea')); - -Fields.forEach(function(field) { - ClassicEditor - .create( field ) - .then( editor => { - //console.log( 'CkEditor was initialized', editor ); - }) - .catch( error => { - console.error( error.stack ); - }) - ; -}); diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.ts b/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.ts new file mode 100644 index 000000000..ed07ce9db --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.ts @@ -0,0 +1,15 @@ +import ClassicEditor from "./editor_config"; + +const ckeditorFields: NodeListOf = document.querySelectorAll('textarea[ckeditor]'); +ckeditorFields.forEach((field: HTMLTextAreaElement): void => { + ClassicEditor + .create( field ) + .then( editor => { + //console.log( 'CkEditor was initialized', editor ); + }) + .catch( error => { + console.error( error.stack ); + }) + ; +}); +//Fields.push.apply(Fields, document.querySelectorAll('.cf-fields textarea')); diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/collection/index.ts b/src/Bundle/ChillMainBundle/Resources/public/module/collection/index.ts index de428335d..875e99fad 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/collection/index.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/module/collection/index.ts @@ -53,14 +53,17 @@ export const handleAdd = (button: any): void => { let empty_explain: HTMLLIElement | null = collection.querySelector('li[data-collection-empty-explain]'), entry = document.createElement('li'), - counter = collection.childNodes.length + 1, - content = prototype.replace(new RegExp('__name__', 'g'), counter.toString()), + counter = collection.querySelectorAll('li.entry').length, // Updated counter logic + content = prototype.replace(/__name__/g, counter.toString()), event = new CustomEvent('collection-add-entry', {detail: new CollectionEventPayload(collection, entry)}); + console.log(counter) + console.log(content) + entry.innerHTML = content; entry.classList.add('entry'); - if ("dataCollectionRegular" in collection.dataset) { + if ("collectionRegular" in collection.dataset) { initializeRemove(collection, entry); if (empty_explain !== null) { empty_explain.remove(); diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js index 6b33c0f52..03220630f 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js @@ -159,3 +159,5 @@ document.addEventListener('DOMContentLoaded', function(e) { loadDynamicPicker(document) }) +window.loadDynamicPicker = loadDynamicPicker; + diff --git a/src/Bundle/ChillMainBundle/Resources/public/page/export/download-export.js b/src/Bundle/ChillMainBundle/Resources/public/page/export/download-export.js new file mode 100644 index 000000000..d0163dc96 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/public/page/export/download-export.js @@ -0,0 +1,16 @@ +import {download_report} from "../../lib/download-report/download-report"; + +window.addEventListener("DOMContentLoaded", function(e) { + const export_generate_url = window.export_generate_url; + + if (typeof export_generate_url === 'undefined') { + console.error('Alias not found!'); + throw new Error('Alias not found!'); + } + + const query = window.location.search, + container = document.querySelector("#download_container") + ; + + download_report(export_generate_url + query.toString(), container); +}); diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/DashboardWidgets/NewsItem.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/DashboardWidgets/NewsItem.vue index d3b499cac..6c1435f58 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/DashboardWidgets/NewsItem.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/DashboardWidgets/NewsItem.vue @@ -125,7 +125,7 @@ const preprocess = (markdown: string): string => { } const postprocess = (html: string): string => { - DOMPurify.addHook('afterSanitizeAttributes', (node) => { + DOMPurify.addHook('afterSanitizeAttributes', (node: any) => { if ('target' in node) { node.setAttribute('target', '_blank'); node.setAttribute('rel', 'noopener noreferrer'); diff --git a/src/Bundle/ChillMainBundle/Resources/views/CRUD/_edit_content.html.twig b/src/Bundle/ChillMainBundle/Resources/views/CRUD/_edit_content.html.twig index 0bfa5d54b..a6f139fd7 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/CRUD/_edit_content.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/CRUD/_edit_content.html.twig @@ -1,5 +1,5 @@ {% set formId = crudMainFormId|default('crud_main_form') %} - + {% block crud_content_header %}

{{ ('crud.'~crud_name~'.title_edit')|trans }}

{% endblock crud_content_header %} @@ -21,9 +21,9 @@