From 579bd829f86bafae8fb10cbffc92d31e4a3cb86a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 4 Apr 2024 23:30:25 +0200 Subject: [PATCH] Apply rector rules: symfony up to 54 --- rector.php | 9 +- .../Controller/ActivityController.php | 21 +-- .../ActivityReasonCategoryController.php | 18 +- .../Controller/ActivityReasonController.php | 18 +- .../Controller/AdminController.php | 10 +- .../ChillActivityBundle/Entity/Activity.php | 70 +++----- .../Entity/ActivityPresence.php | 6 +- .../Entity/ActivityType.php | 22 +-- .../src/Controller/AdminController.php | 4 +- .../src/Entity/AsideActivity.php | 3 +- .../src/Entity/AsideActivityCategory.php | 4 +- .../Controller/Admin/AdminController.php | 4 +- .../Controller/ChargeController.php | 15 +- .../Controller/ElementController.php | 8 +- .../Controller/ResourceController.php | 18 +- .../Entity/AbstractElement.php | 19 +-- .../ChillBudgetBundle/Entity/ChargeKind.php | 9 +- .../ChillBudgetBundle/Entity/ResourceKind.php | 11 +- .../AzureGrantAdminConsentAndAcquireToken.php | 4 +- .../MapAndSubscribeUserCalendarCommand.php | 5 +- .../SendShortMessageOnEligibleCalendar.php | 2 +- .../SendTestShortMessageOnCalendarCommand.php | 9 +- .../Controller/AdminController.php | 3 +- .../Controller/CalendarAPIController.php | 7 +- .../Controller/CalendarController.php | 26 +-- .../Controller/CalendarDocController.php | 12 +- .../Controller/CalendarRangeAPIController.php | 7 +- .../Controller/InviteApiController.php | 3 +- .../RemoteCalendarConnectAzureController.php | 8 +- .../RemoteCalendarMSGraphSyncController.php | 5 +- .../RemoteCalendarProxyController.php | 4 +- .../ChillCalendarBundle/Entity/Calendar.php | 72 +++----- .../CalendarDoc/CalendarDocCreateDTO.php | 14 +- .../Entity/CalendarDoc/CalendarDocEditDTO.php | 11 +- .../Entity/CalendarRange.php | 27 +-- .../ChillCalendarBundle/Entity/Invite.php | 9 +- .../RemoteCalendar/Model/RemoteEvent.php | 20 +-- .../Command/CreateFieldsOnGroupCommand.php | 4 +- .../Controller/AdminController.php | 4 +- .../Controller/CustomFieldController.php | 12 +- .../CustomFieldsGroupController.php | 21 +-- .../AdminDocGeneratorTemplateController.php | 4 +- .../DocGeneratorTemplateController.php | 27 +-- .../Entity/DocGeneratorTemplate.php | 14 +- .../Normalizer/DocGenObjectNormalizerTest.php | 27 +-- ...ConfigureOpenstackObjectStorageCommand.php | 5 +- .../AsyncUpload/SignedUrl.php | 13 +- .../AsyncUpload/SignedUrlPost.php | 30 +--- .../Controller/AdminController.php | 6 +- .../Controller/AsyncUploadController.php | 5 +- .../DocumentAccompanyingCourseController.php | 20 +-- .../Controller/DocumentCategoryController.php | 25 +-- .../Controller/DocumentPersonController.php | 21 +-- ...ericDocForAccompanyingPeriodController.php | 3 +- .../Controller/GenericDocForPerson.php | 3 +- .../Controller/StoredObjectApiController.php | 4 +- .../ChillDocStoreBundle/Entity/Document.php | 13 +- .../Entity/StoredObject.php | 37 ++--- .../Controller/AdminController.php | 3 +- .../Controller/EventController.php | 22 +-- .../Controller/EventListController.php | 4 +- .../Controller/EventTypeController.php | 21 +-- .../Controller/ParticipationController.php | 22 +-- .../Controller/RoleController.php | 21 +-- .../Controller/StatusController.php | 21 +-- src/Bundle/ChillEventBundle/Entity/Event.php | 9 +- .../ChillEventBundle/Entity/Participation.php | 11 +- .../Command/ChillImportUsersCommand.php | 9 +- .../ChillUserSendRenewPasswordCodeCommand.php | 4 +- .../Command/ExecuteCronJobCommand.php | 7 +- .../LoadAddressesBEFromBestAddressCommand.php | 7 +- .../LoadAddressesFRFromBANOCommand.php | 7 +- .../Command/LoadAndUpdateLanguagesCommand.php | 4 +- .../Command/LoadCountriesCommand.php | 6 +- .../Command/LoadPostalCodeFR.php | 7 +- .../Command/LoadPostalCodesCommand.php | 5 +- .../Command/SetPasswordCommand.php | 8 +- .../SynchronizeEntityInfoViewsCommand.php | 10 +- .../Controller/AbsenceController.php | 16 +- .../Controller/AddressApiController.php | 4 +- .../AddressReferenceAPIController.php | 4 +- .../AddressToReferenceMatcherController.php | 11 +- .../Controller/AdminController.php | 20 +-- .../Controller/DashboardApiController.php | 3 +- .../Controller/DefaultController.php | 8 +- .../Controller/ExportController.php | 23 +-- ...GeographicalUnitByAddressApiController.php | 4 +- .../Controller/LoginController.php | 2 + .../Controller/NewsItemApiController.php | 3 +- .../Controller/NewsItemHistoryController.php | 8 +- .../Controller/NotificationApiController.php | 16 +- .../Controller/NotificationController.php | 28 +--- .../Controller/PasswordController.php | 22 +-- .../Controller/PermissionApiController.php | 3 +- .../Controller/PermissionsGroupController.php | 25 +-- .../Controller/PostalCodeAPIController.php | 4 +- .../Controller/PostalCodeController.php | 5 +- .../Controller/SavedExportController.php | 12 +- .../Controller/ScopeController.php | 12 +- .../Controller/SearchController.php | 16 +- .../Controller/TimelineCenterController.php | 7 +- .../Controller/UserApiController.php | 20 +-- .../Controller/UserController.php | 23 +-- .../Controller/UserExportController.php | 6 +- .../UserJobScopeHistoriesController.php | 4 +- .../Controller/UserProfileController.php | 3 +- .../Controller/WorkflowApiController.php | 14 +- .../Controller/WorkflowController.php | 34 +--- .../DataFixtures/ORM/LoadUsers.php | 3 +- .../Doctrine/Model/TrackCreationTrait.php | 6 +- .../Doctrine/Model/TrackUpdateTrait.php | 6 +- src/Bundle/ChillMainBundle/Entity/Address.php | 54 ++---- .../Entity/AddressReference.php | 33 ++-- src/Bundle/ChillMainBundle/Entity/Center.php | 6 +- .../ChillMainBundle/Entity/Civility.php | 15 +- src/Bundle/ChillMainBundle/Entity/Country.php | 9 +- .../Entity/DashboardConfigItem.php | 18 +- .../SimpleGeographicalUnitDTO.php | 12 +- .../Entity/GeographicalUnitLayer.php | 9 +- .../ChillMainBundle/Entity/Language.php | 6 +- .../ChillMainBundle/Entity/Location.php | 44 ++--- .../ChillMainBundle/Entity/LocationType.php | 32 ++-- .../ChillMainBundle/Entity/NewsItem.php | 33 ++-- .../ChillMainBundle/Entity/Notification.php | 6 +- .../Entity/NotificationComment.php | 3 +- .../ChillMainBundle/Entity/PostalCode.php | 24 +-- .../ChillMainBundle/Entity/SavedExport.php | 6 +- src/Bundle/ChillMainBundle/Entity/Scope.php | 11 +- src/Bundle/ChillMainBundle/Entity/User.php | 5 +- src/Bundle/ChillMainBundle/Entity/UserJob.php | 11 +- .../Entity/Workflow/EntityWorkflow.php | 8 +- .../Entity/Workflow/EntityWorkflowStep.php | 4 +- .../Form/DataMapper/AddressDataMapper.php | 4 +- .../DataMapper/ExportPickCenterDataMapper.php | 4 +- .../DataMapper/PrivateCommentDataMapper.php | 4 +- .../Form/DataMapper/RollingDateDataMapper.php | 4 +- .../Form/DataMapper/ScopePickerDataMapper.php | 4 +- .../ChillMainBundle/Form/UserPasswordType.php | 5 +- .../Search/SearchApiResult.php | 8 +- .../Security/UserProvider/UserProvider.php | 5 +- .../Tests/Controller/UserControllerTest.php | 7 +- .../Command/ChillPersonMoveCommand.php | 5 +- .../Command/ImportSocialWorkMetadata.php | 1 - ...emoveOldDraftAccompanyingPeriodCommand.php | 5 +- .../AccompanyingCourseApiController.php | 16 +- .../AccompanyingCourseCommentController.php | 17 +- .../AccompanyingCourseController.php | 27 +-- .../AccompanyingCourseWorkApiController.php | 4 +- .../AccompanyingCourseWorkController.php | 41 +---- ...CourseWorkEvaluationDocumentController.php | 8 +- .../AccompanyingPeriodController.php | 23 +-- ...mpanyingPeriodRegulationListController.php | 4 +- ...nyingPeriodWorkEvaluationApiController.php | 9 +- .../Controller/AdminController.php | 19 +-- .../Controller/HouseholdApiController.php | 16 +- .../HouseholdCompositionController.php | 12 +- .../Controller/HouseholdController.php | 60 +------ .../Controller/HouseholdMemberController.php | 20 +-- .../Controller/PersonAddressController.php | 20 +-- .../Controller/PersonApiController.php | 23 +-- .../Controller/PersonController.php | 20 +-- .../Controller/PersonDuplicateController.php | 20 +-- .../Controller/PersonResourceController.php | 16 +- .../ReassignAccompanyingPeriodController.php | 4 +- .../ResidentialAddressController.php | 16 +- .../SocialWorkEvaluationApiController.php | 8 +- .../Controller/TimelinePersonController.php | 4 +- .../UserAccompanyingPeriodController.php | 8 +- .../Entity/AccompanyingPeriod.php | 154 ++++++------------ .../AccompanyingPeriodWork.php | 91 +++-------- .../AccompanyingPeriodWorkEvaluation.php | 69 ++------ ...companyingPeriodWorkEvaluationDocument.php | 31 +--- .../AccompanyingPeriodWorkGoal.php | 23 +-- .../AccompanyingPeriod/ClosingMotive.php | 6 +- .../Entity/AccompanyingPeriod/Comment.php | 29 +--- .../Entity/AccompanyingPeriod/Origin.php | 16 +- .../Entity/AccompanyingPeriod/Resource.php | 25 ++- .../AccompanyingPeriodParticipation.php | 25 +-- .../Entity/Household/Household.php | 53 ++---- .../Entity/Household/HouseholdComposition.php | 32 ++-- .../Household/HouseholdCompositionType.php | 11 +- .../Entity/Household/HouseholdMember.php | 47 ++---- .../Entity/Household/Position.php | 20 +-- .../ChillPersonBundle/Entity/Person.php | 63 +++---- .../Entity/Person/PersonResource.php | 34 ++-- .../Entity/Person/PersonResourceKind.php | 6 +- .../Entity/Person/ResidentialAddress.php | 15 +- .../Entity/PersonAltName.php | 6 +- .../Entity/Relationships/Relation.php | 17 +- .../Entity/Relationships/Relationship.php | 35 ++-- .../Entity/SocialWork/Evaluation.php | 20 +-- .../Entity/SocialWork/Goal.php | 14 +- .../Entity/SocialWork/Result.php | 14 +- .../Entity/SocialWork/SocialAction.php | 8 +- .../Entity/SocialWork/SocialIssue.php | 8 +- .../DataMapper/PersonAltNameDataMapper.php | 4 +- .../Controller/SingleTaskController.php | 58 +------ .../Controller/TaskController.php | 6 +- .../ChillTaskBundle/Entity/AbstractTask.php | 32 ++-- .../ChillTaskBundle/Entity/SingleTask.php | 38 ++--- .../Controller/AdminController.php | 3 +- .../Entity/ThirdParty.php | 70 +++----- .../Entity/ThirdPartyCategory.php | 6 +- .../Entity/ThirdPartyProfession.php | 13 +- 204 files changed, 974 insertions(+), 2346 deletions(-) diff --git a/rector.php b/rector.php index 836202495..ec3020ddf 100644 --- a/rector.php +++ b/rector.php @@ -35,10 +35,13 @@ return static function (RectorConfig $rectorConfig): void { //define sets of rules $rectorConfig->sets([ - LevelSetList::UP_TO_PHP_82, - \Rector\Symfony\Set\SymfonyLevelSetList::UP_TO_SYMFONY_50, + \Rector\Symfony\Set\SymfonySetList::SYMFONY_50, + \Rector\Symfony\Set\SymfonySetList::SYMFONY_50_TYPES, + \Rector\Symfony\Set\SymfonySetList::SYMFONY_51, + \Rector\Symfony\Set\SymfonySetList::SYMFONY_52, + \Rector\Symfony\Set\SymfonySetList::SYMFONY_53, + \Rector\Symfony\Set\SymfonySetList::SYMFONY_54, \Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY, - \Rector\PHPUnit\Set\PHPUnitLevelSetList::UP_TO_PHPUNIT_90, ]); // migrate for phpunit diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 7098f283e..2248c54d3 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -73,9 +73,8 @@ final class ActivityController extends AbstractController /** * Deletes a Activity entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/{id}/delete", name="chill_activity_activity_delete", methods={"GET", "POST", "DELETE"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/{id}/delete', name: 'chill_activity_activity_delete', methods: ['GET', 'POST', 'DELETE'])] public function deleteAction(Request $request, mixed $id) { $view = null; @@ -143,9 +142,8 @@ final class ActivityController extends AbstractController /** * Displays a form to edit an existing Activity entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/{id}/edit", name="chill_activity_activity_edit", methods={"GET", "POST", "PUT"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/{id}/edit', name: 'chill_activity_activity_edit', methods: ['GET', 'POST', 'PUT'])] public function editAction(int $id, Request $request): Response { $view = null; @@ -238,9 +236,8 @@ final class ActivityController extends AbstractController /** * Lists all Activity entities. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/", name="chill_activity_activity_list") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/', name: 'chill_activity_activity_list')] public function listAction(Request $request): Response { $view = null; @@ -344,9 +341,7 @@ final class ActivityController extends AbstractController return $filterBuilder->build(); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/new", name="chill_activity_activity_new", methods={"POST", "GET"}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/new', name: 'chill_activity_activity_new', methods: ['POST', 'GET'])] public function newAction(Request $request): Response { $view = null; @@ -527,9 +522,7 @@ final class ActivityController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/select-type", name="chill_activity_activity_select_type") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/select-type', name: 'chill_activity_activity_select_type')] public function selectTypeAction(Request $request): Response { $view = null; @@ -574,9 +567,7 @@ final class ActivityController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/{id}/show", name="chill_activity_activity_show") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/{id}/show', name: 'chill_activity_activity_show')] public function showAction(Request $request, int $id): Response { $entity = $this->activityRepository->find($id); diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php index 67f65d994..0d337416b 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php @@ -26,9 +26,8 @@ class ActivityReasonCategoryController extends AbstractController /** * Creates a new ActivityReasonCategory entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/create", name="chill_activity_activityreasoncategory_create", methods={"POST"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/create', name: 'chill_activity_activityreasoncategory_create', methods: ['POST'])] public function createAction(Request $request) { $entity = new ActivityReasonCategory(); @@ -51,9 +50,8 @@ class ActivityReasonCategoryController extends AbstractController /** * Displays a form to edit an existing ActivityReasonCategory entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/{id}/edit", name="chill_activity_activityreasoncategory_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/{id}/edit', name: 'chill_activity_activityreasoncategory_edit')] public function editAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -74,9 +72,8 @@ class ActivityReasonCategoryController extends AbstractController /** * Lists all ActivityReasonCategory entities. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/", name="chill_activity_activityreasoncategory") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/', name: 'chill_activity_activityreasoncategory')] public function indexAction() { $em = $this->managerRegistry->getManager(); @@ -90,9 +87,8 @@ class ActivityReasonCategoryController extends AbstractController /** * Displays a form to create a new ActivityReasonCategory entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/new", name="chill_activity_activityreasoncategory_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/new', name: 'chill_activity_activityreasoncategory_new')] public function newAction() { $entity = new ActivityReasonCategory(); @@ -106,9 +102,8 @@ class ActivityReasonCategoryController extends AbstractController /** * Finds and displays a ActivityReasonCategory entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/{id}/show", name="chill_activity_activityreasoncategory_show") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/{id}/show', name: 'chill_activity_activityreasoncategory_show')] public function showAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -126,9 +121,8 @@ class ActivityReasonCategoryController extends AbstractController /** * Edits an existing ActivityReasonCategory entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/{id}/update", name="chill_activity_activityreasoncategory_update", methods={"POST", "PUT"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/{id}/update', name: 'chill_activity_activityreasoncategory_update', methods: ['POST', 'PUT'])] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php index cb6514656..37d04d367 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php @@ -28,9 +28,8 @@ class ActivityReasonController extends AbstractController /** * Creates a new ActivityReason entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/create", name="chill_activity_activityreason_create", methods={"POST"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/create', name: 'chill_activity_activityreason_create', methods: ['POST'])] public function createAction(Request $request) { $entity = new ActivityReason(); @@ -53,9 +52,8 @@ class ActivityReasonController extends AbstractController /** * Displays a form to edit an existing ActivityReason entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/{id}/edit", name="chill_activity_activityreason_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/{id}/edit', name: 'chill_activity_activityreason_edit')] public function editAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -76,9 +74,8 @@ class ActivityReasonController extends AbstractController /** * Lists all ActivityReason entities. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/", name="chill_activity_activityreason") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/', name: 'chill_activity_activityreason')] public function indexAction() { $em = $this->managerRegistry->getManager(); @@ -92,9 +89,8 @@ class ActivityReasonController extends AbstractController /** * Displays a form to create a new ActivityReason entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/new", name="chill_activity_activityreason_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/new', name: 'chill_activity_activityreason_new')] public function newAction() { $entity = new ActivityReason(); @@ -108,9 +104,8 @@ class ActivityReasonController extends AbstractController /** * Finds and displays a ActivityReason entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/{id}/show", name="chill_activity_activityreason_show") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/{id}/show', name: 'chill_activity_activityreason_show')] public function showAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -128,9 +123,8 @@ class ActivityReasonController extends AbstractController /** * Edits an existing ActivityReason entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/{id}/update", name="chill_activity_activityreason_update", methods={"POST", "PUT"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/{id}/update', name: 'chill_activity_activityreason_update', methods: ['POST', 'PUT'])] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillActivityBundle/Controller/AdminController.php b/src/Bundle/ChillActivityBundle/Controller/AdminController.php index deca96bd7..39438eb8d 100644 --- a/src/Bundle/ChillActivityBundle/Controller/AdminController.php +++ b/src/Bundle/ChillActivityBundle/Controller/AdminController.php @@ -18,18 +18,14 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; */ class AdminController extends AbstractController { - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activity", name="chill_activity_admin_index") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activity', name: 'chill_activity_admin_index')] public function indexActivityAction() { return $this->render('@ChillActivity/Admin/layout_activity.html.twig'); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activity_redirect_to_main", name="chill_admin_aside_activity_redirect_to_admin_index", options={null}) - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activity_redirect_to_main", name="chill_admin_activity_redirect_to_admin_index") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activity_redirect_to_main', name: 'chill_admin_aside_activity_redirect_to_admin_index', options: [null])] + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activity_redirect_to_main', name: 'chill_admin_activity_redirect_to_admin_index')] public function redirectToAdminIndexAction() { return $this->redirectToRoute('chill_main_admin_central'); diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php index 9407aecbe..ec1ae23e2 100644 --- a/src/Bundle/ChillActivityBundle/Entity/Activity.php +++ b/src/Bundle/ChillActivityBundle/Entity/Activity.php @@ -50,10 +50,6 @@ use Symfony\Component\Validator\Constraints as Assert; * * @ORM\HasLifecycleCallbacks * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "activity": Activity::class - * }) - * * @ActivityValidator\ActivityValidity * * TODO see if necessary @@ -62,6 +58,7 @@ use Symfony\Component\Validator\Constraints as Assert; * getUserFunction="getUser", * path="scope") */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['activity' => Activity::class])] class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, HasCentersInterface, HasScopesInterface, TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; @@ -74,50 +71,43 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac /** * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod") - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?AccompanyingPeriod $accompanyingPeriod = null; /** * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType") * - * @Groups({"read", "docgen:read"}) - * - * @SerializedName("activityType") - * * @ORM\JoinColumn(name="type_id") */ + #[Groups(['read', 'docgen:read'])] + #[SerializedName('activityType')] private ActivityType $activityType; /** * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence") - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private ?ActivityPresence $attendee = null; /** * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_") - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private CommentEmbeddable $comment; /** * @ORM\Column(type="datetime") - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private \DateTime $date; /** * @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"}) * - * @Assert\Valid(traverse=true) - * * @var Collection */ + #[Assert\Valid(traverse: true)] private Collection $documents; /** @@ -127,9 +117,8 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac /** * @ORM\Column(type="boolean", options={"default": false}) - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private bool $emergency = false; /** @@ -138,16 +127,14 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location") - * - * @groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?Location $location = null; /** @@ -158,10 +145,9 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac /** * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person") * - * @Groups({"read", "docgen:read"}) - * * @var Collection */ + #[Groups(['read', 'docgen:read'])] private Collection $persons; /** @@ -172,24 +158,21 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac /** * @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason") * - * @Groups({"docgen:read"}) - * * @var Collection */ + #[Groups(['docgen:read'])] private Collection $reasons; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope") - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private ?Scope $scope = null; /** * @ORM\Column(type="string", options={"default": ""}) - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private string $sentReceived = ''; /** @@ -197,10 +180,9 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac * * @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction") * - * @Groups({"read", "docgen:read"}) - * * @var Collection */ + #[Groups(['read', 'docgen:read'])] private Collection $socialActions; /** @@ -208,19 +190,17 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac * * @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue") * - * @Groups({"read", "docgen:read"}) - * * @var Collection */ + #[Groups(['read', 'docgen:read'])] private Collection $socialIssues; /** * @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty") * - * @Groups({"read", "docgen:read"}) - * * @var Collection */ + #[Groups(['read', 'docgen:read'])] private Collection $thirdParties; /** @@ -230,18 +210,16 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private ?User $user = null; /** * @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User") * - * @Groups({"read", "docgen:read"}) - * * @var Collection */ + #[Groups(['read', 'docgen:read'])] private Collection $users; public function __construct() @@ -385,9 +363,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac return $this->documents; } - /** - * @Groups({"docgen:read"}) - */ + #[Groups(['docgen:read'])] public function getDurationMinute(): int { if (null === $this->durationTime) { @@ -515,9 +491,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac return $this->travelTime; } - /** - * @Groups({"docgen:read"}) - */ + #[Groups(['docgen:read'])] public function getTravelTimeMinute(): int { if (null === $this->travelTime) { diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php b/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php index c181b7c6b..0a558c51b 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php @@ -36,18 +36,16 @@ class ActivityPresence * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="json") * - * @Serializer\Groups({"docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private array $name = []; /** diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index 96c369b39..404cda36c 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -50,9 +50,8 @@ class ActivityType /** * @ORM\Column(type="boolean") - * - * @Groups({"read"}) */ + #[Groups(['read'])] private bool $active = true; /** @@ -126,9 +125,8 @@ class ActivityType * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private ?int $id = null; /** @@ -144,10 +142,9 @@ class ActivityType /** * @ORM\Column(type="json") * - * @Groups({"read", "docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private array $name = []; /** @@ -167,9 +164,8 @@ class ActivityType /** * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - * - * @Groups({"read"}) */ + #[Groups(['read'])] private int $personsVisible = self::FIELD_OPTIONAL; /** @@ -248,9 +244,8 @@ class ActivityType /** * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - * - * @Groups({"read"}) */ + #[Groups(['read'])] private int $thirdPartiesVisible = self::FIELD_INVISIBLE; /** @@ -275,9 +270,8 @@ class ActivityType /** * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - * - * @Groups({"read"}) */ + #[Groups(['read'])] private int $usersVisible = self::FIELD_OPTIONAL; /** @@ -285,9 +279,7 @@ class ActivityType */ private int $userVisible = self::FIELD_REQUIRED; - /** - * @Assert\Callback - */ + #[Assert\Callback] public function checkSocialActionsVisibility(ExecutionContextInterface $context, mixed $payload) { if ($this->socialIssuesVisible !== $this->socialActionsVisible) { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Controller/AdminController.php b/src/Bundle/ChillAsideActivityBundle/src/Controller/AdminController.php index cbf0ba9ec..08af67639 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Controller/AdminController.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Controller/AdminController.php @@ -19,9 +19,7 @@ use Symfony\Component\Routing\Annotation\Route; */ class AdminController extends AbstractController { - /** - * @Route("/{_locale}/admin/aside-activity", name="chill_aside_activity_admin") - */ + #[Route(path: '/{_locale}/admin/aside-activity', name: 'chill_aside_activity_admin')] public function indexAdminAction() { return $this->render('@ChillAsideActivity/Admin/index.html.twig'); diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php index f43a0fdfb..02da401bc 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php @@ -29,9 +29,8 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=false) - * - * @Assert\NotBlank */ + #[Assert\NotBlank] private User $agent; /** diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php index be71d73f9..e5eb044d9 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php @@ -117,9 +117,7 @@ class AsideActivityCategory return null !== $this->parent; } - /** - * @Assert\Callback - */ + #[Assert\Callback] public function preventRecursiveParent(ExecutionContextInterface $context, mixed $payload) { if (!$this->hasParent()) { diff --git a/src/Bundle/ChillBudgetBundle/Controller/Admin/AdminController.php b/src/Bundle/ChillBudgetBundle/Controller/Admin/AdminController.php index 998775fbe..3bb696757 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/Admin/AdminController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/Admin/AdminController.php @@ -16,9 +16,7 @@ use Symfony\Component\Routing\Annotation\Route; class AdminController extends AbstractController { - /** - * @Route("/{_locale}/admin/budget", name="chill_admin_budget") - */ + #[Route(path: '/{_locale}/admin/budget', name: 'chill_admin_budget')] public function indexAdminAction() { return $this->render('@ChillBudget/Admin/index.html.twig'); diff --git a/src/Bundle/ChillBudgetBundle/Controller/ChargeController.php b/src/Bundle/ChillBudgetBundle/Controller/ChargeController.php index 39e96d4a8..480e2c645 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/ChargeController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/ChargeController.php @@ -21,9 +21,8 @@ class ChargeController extends AbstractElementController { /** * @return \Symfony\Component\HttpFoundation\Response - * - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/{id}/delete", name="chill_budget_charge_delete") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/{id}/delete', name: 'chill_budget_charge_delete')] public function deleteAction(Request $request, Charge $charge) { return $this->_delete( @@ -36,9 +35,8 @@ class ChargeController extends AbstractElementController /** * @return \Symfony\Component\HttpFoundation\Response - * - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/{id}/edit", name="chill_budget_charge_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/{id}/edit', name: 'chill_budget_charge_edit')] public function editAction(Request $request, Charge $charge) { return $this->_edit( @@ -51,9 +49,8 @@ class ChargeController extends AbstractElementController /** * @return \Symfony\Component\HttpFoundation\Response - * - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/by-person/{id}/new", name="chill_budget_charge_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/by-person/{id}/new', name: 'chill_budget_charge_new')] public function newAction(Request $request, Person $person) { return $this->_new( @@ -66,9 +63,8 @@ class ChargeController extends AbstractElementController /** * @return \Symfony\Component\HttpFoundation\Response - * - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/by-household/{id}/new", name="chill_budget_charge_household_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/by-household/{id}/new', name: 'chill_budget_charge_household_new')] public function newHouseholdAction(Request $request, Household $household) { return $this->_new( @@ -81,9 +77,8 @@ class ChargeController extends AbstractElementController /** * @return \Symfony\Component\HttpFoundation\Response - * - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/{id}/view", name="chill_budget_charge_view") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/{id}/view', name: 'chill_budget_charge_view')] public function viewAction(Charge $charge) { return $this->_view($charge, '@ChillBudget/Charge/view.html.twig'); diff --git a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php index 26acbf8a5..48f86dedd 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php @@ -23,9 +23,7 @@ class ElementController extends AbstractController { public function __construct(private readonly CalculatorManager $calculator, private readonly ResourceRepository $resourceRepository, private readonly ChargeRepository $chargeRepository) {} - /** - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/elements/by-person/{id}", name="chill_budget_elements_index") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/elements/by-person/{id}', name: 'chill_budget_elements_index')] public function indexAction(Person $person) { $this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $person); @@ -47,9 +45,7 @@ class ElementController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/elements/by-household/{id}", name="chill_budget_elements_household_index") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/elements/by-household/{id}', name: 'chill_budget_elements_household_index')] public function indexHouseholdAction(Household $household) { $this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $household); diff --git a/src/Bundle/ChillBudgetBundle/Controller/ResourceController.php b/src/Bundle/ChillBudgetBundle/Controller/ResourceController.php index f67d92a43..fd9dc9f63 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/ResourceController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/ResourceController.php @@ -20,9 +20,7 @@ use Symfony\Component\HttpFoundation\Response; class ResourceController extends AbstractElementController { - /** - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/{id}/delete", name="chill_budget_resource_delete") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/{id}/delete', name: 'chill_budget_resource_delete')] public function deleteAction(Request $request, Resource $resource) { return $this->_delete( @@ -33,9 +31,7 @@ class ResourceController extends AbstractElementController ); } - /** - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/{id}/edit", name="chill_budget_resource_edit") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/{id}/edit', name: 'chill_budget_resource_edit')] public function editAction(Request $request, Resource $resource): Response { return $this->_edit( @@ -48,9 +44,8 @@ class ResourceController extends AbstractElementController /** * Create a new budget element for a person. - * - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/by-person/{id}/new", name="chill_budget_resource_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/by-person/{id}/new', name: 'chill_budget_resource_new')] public function newAction(Request $request, Person $person): Response { return $this->_new( @@ -63,9 +58,8 @@ class ResourceController extends AbstractElementController /** * Create new budget element for a household. - * - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/by-household/{id}/new", name="chill_budget_resource_household_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/by-household/{id}/new', name: 'chill_budget_resource_household_new')] public function newHouseholdAction(Request $request, Household $household): Response { return $this->_new( @@ -76,9 +70,7 @@ class ResourceController extends AbstractElementController ); } - /** - * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/{id}/view", name="chill_budget_resource_view") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/{id}/view', name: 'chill_budget_resource_view')] public function viewAction(Resource $resource): Response { return $this->_view($resource, '@ChillBudget/Resource/view.html.twig'); diff --git a/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php b/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php index 85420e670..e57438f0f 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php +++ b/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php @@ -27,15 +27,9 @@ abstract class AbstractElement { /** * @ORM\Column(name="amount", type="decimal", precision=10, scale=2) - * - * @Assert\GreaterThan( - * value=0 - * ) - * - * @Assert\NotNull( - * message="The amount cannot be empty" - * ) */ + #[Assert\GreaterThan(value: 0)] + #[Assert\NotNull(message: 'The amount cannot be empty')] private string $amount; /** @@ -45,12 +39,8 @@ abstract class AbstractElement /** * @ORM\Column(name="endDate", type="datetime_immutable", nullable=true) - * - * @Assert\GreaterThan( - * propertyPath="startDate", - * message="The budget element's end date must be after the start date" - * ) */ + #[Assert\GreaterThan(propertyPath: 'startDate', message: "The budget element's end date must be after the start date")] private ?\DateTimeImmutable $endDate = null; /** @@ -69,9 +59,8 @@ abstract class AbstractElement /** * @ORM\Column(name="startDate", type="datetime_immutable") - * - * @Assert\Date */ + #[Assert\Date] private \DateTimeImmutable $startDate; /** diff --git a/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php b/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php index 2196a0e99..4150d09cc 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php +++ b/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php @@ -23,9 +23,8 @@ use Symfony\Component\Validator\Constraints as Assert; * ) * * @ORM\Entity - * - * @UniqueEntity(fields={"kind"}) */ +#[UniqueEntity(fields: ['kind'])] class ChargeKind { /** @@ -44,11 +43,9 @@ class ChargeKind /** * @ORM\Column(type="string", length=255, options={"default": ""}, nullable=false) - * - * @Assert\Regex(pattern="/^[a-z0-9\-_]{1,}$/", message="budget.admin.form.kind.only_alphanumeric") - * - * @Assert\Length(min=3) */ + #[Assert\Regex(pattern: '/^[a-z0-9\-_]{1,}$/', message: 'budget.admin.form.kind.only_alphanumeric')] + #[Assert\Length(min: 3)] private string $kind = ''; /** diff --git a/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php b/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php index 78e0e6a32..2e0e360d9 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php +++ b/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php @@ -22,11 +22,12 @@ use Symfony\Component\Validator\Constraints as Assert; * * @ORM\UniqueConstraint(name="resource_kind_unique_type_idx", fields={"kind"}) * }) + * @ORM\UniqueConstraint(name="resource_kind_unique_type_idx", fields={"kind"}) + * }) * * @ORM\Entity - * - * @UniqueEntity(fields={"kind"}) */ +#[UniqueEntity(fields: ['kind'])] class ResourceKind { /** @@ -45,11 +46,9 @@ class ResourceKind /** * @ORM\Column(type="string", length=255, nullable=false, options={"default": ""}) - * - * @Assert\Regex(pattern="/^[a-z0-9\-_]{1,}$/", message="budget.admin.form.kind.only_alphanumeric") - * - * @Assert\Length(min=3) */ + #[Assert\Regex(pattern: '/^[a-z0-9\-_]{1,}$/', message: 'budget.admin.form.kind.only_alphanumeric')] + #[Assert\Length(min: 3)] private string $kind = ''; /** diff --git a/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php b/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php index c9bf020b1..f98ca2418 100644 --- a/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php +++ b/src/Bundle/ChillCalendarBundle/Command/AzureGrantAdminConsentAndAcquireToken.php @@ -56,7 +56,7 @@ class AzureGrantAdminConsentAndAcquireToken extends Command $messages = ['No problem, we will wait for you', 'Grant access and come back here']; $output->writeln($formatter->formatBlock($messages, 'warning')); - return 0; + return Command::SUCCESS; } $token = $this->machineTokenStorage->getToken(); @@ -69,6 +69,6 @@ class AzureGrantAdminConsentAndAcquireToken extends Command $output->writeln('Expires at: '.$token->getExpires()); $output->writeln('To inspect the token content, go to https://jwt.ms/#access_token='.urlencode($token->getToken())); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php b/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php index 4964f0064..41830cd44 100644 --- a/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php +++ b/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php @@ -32,6 +32,8 @@ use Symfony\Component\Console\Output\OutputInterface; final class MapAndSubscribeUserCalendarCommand extends Command { + protected static $defaultDescription = 'MSGraph: collect user metadata and create subscription on events for users, and sync the user absence-presence'; + public function __construct( private readonly EntityManagerInterface $em, private readonly EventsOnUserSubscriptionCreator $eventsOnUserSubscriptionCreator, @@ -154,7 +156,7 @@ final class MapAndSubscribeUserCalendarCommand extends Command $output->writeln('users synchronized'); - return 0; + return Command::SUCCESS; } protected function configure() @@ -162,7 +164,6 @@ final class MapAndSubscribeUserCalendarCommand extends Command parent::configure(); $this - ->setDescription('MSGraph: collect user metadata and create subscription on events for users, and sync the user absence-presence') ->addOption( 'renew-before-end-interval', 'r', diff --git a/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php b/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php index 6c1b31b9e..7d0426a24 100644 --- a/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php +++ b/src/Bundle/ChillCalendarBundle/Command/SendShortMessageOnEligibleCalendar.php @@ -34,6 +34,6 @@ class SendShortMessageOnEligibleCalendar extends Command { $this->messageSender->sendBulkMessageToEligibleCalendars(); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php b/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php index 225b540df..1b76f25fa 100644 --- a/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php +++ b/src/Bundle/ChillCalendarBundle/Command/SendTestShortMessageOnCalendarCommand.php @@ -39,6 +39,8 @@ use Symfony\Component\Console\Question\Question; class SendTestShortMessageOnCalendarCommand extends Command { + protected static $defaultDescription = 'Test sending a SMS for a dummy calendar appointment'; + public function __construct( private readonly PersonRepository $personRepository, private readonly PhoneNumberUtil $phoneNumberUtil, @@ -50,10 +52,7 @@ class SendTestShortMessageOnCalendarCommand extends Command parent::__construct('chill:calendar:test-send-short-message'); } - protected function configure() - { - $this->setDescription('Test sending a SMS for a dummy calendar appointment'); - } + protected function configure() {} protected function execute(InputInterface $input, OutputInterface $output): int { @@ -174,6 +173,6 @@ class SendTestShortMessageOnCalendarCommand extends Command } } - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillCalendarBundle/Controller/AdminController.php b/src/Bundle/ChillCalendarBundle/Controller/AdminController.php index fceddf45a..0ba21c94f 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/AdminController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/AdminController.php @@ -18,9 +18,8 @@ class AdminController extends AbstractController { /** * Calendar admin. - * - * @Route("/{_locale}/admin/calendar", name="chill_calendar_admin_index") */ + #[Route(path: '/{_locale}/admin/calendar', name: 'chill_calendar_admin_index')] public function indexAdminAction() { return $this->render('@ChillCalendar/Admin/index.html.twig'); diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php index 1729c215b..eb5812b4d 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php @@ -25,12 +25,7 @@ class CalendarAPIController extends ApiController { public function __construct(private readonly CalendarRepository $calendarRepository) {} - /** - * @Route("/api/1.0/calendar/calendar/by-user/{id}.{_format}", - * name="chill_api_single_calendar_list_by-user", - * requirements={"_format": "json"} - * ) - */ + #[Route(path: '/api/1.0/calendar/calendar/by-user/{id}.{_format}', name: 'chill_api_single_calendar_list_by-user', requirements: ['_format' => 'json'])] public function listByUser(User $user, Request $request, string $_format): JsonResponse { $this->denyAccessUnlessGranted('ROLE_USER'); diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php index 0797f2f56..328b8788f 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php @@ -64,9 +64,8 @@ class CalendarController extends AbstractController /** * Delete a calendar item. - * - * @Route("/{_locale}/calendar/{id}/delete", name="chill_calendar_calendar_delete") */ + #[Route(path: '/{_locale}/calendar/{id}/delete', name: 'chill_calendar_calendar_delete')] public function deleteAction(Request $request, Calendar $entity) { $em = $this->managerRegistry->getManager(); @@ -114,9 +113,8 @@ class CalendarController extends AbstractController /** * Edit a calendar item. - * - * @Route("/{_locale}/calendar/calendar/{id}/edit", name="chill_calendar_calendar_edit") */ + #[Route(path: '/{_locale}/calendar/calendar/{id}/edit', name: 'chill_calendar_calendar_edit')] public function editAction(Calendar $entity, Request $request): Response { $this->denyAccessUnlessGranted(CalendarVoter::EDIT, $entity); @@ -194,9 +192,8 @@ class CalendarController extends AbstractController /** * Lists all Calendar entities. - * - * @Route("/{_locale}/calendar/calendar/by-period/{id}", name="chill_calendar_calendar_list_by_period") */ + #[Route(path: '/{_locale}/calendar/calendar/by-period/{id}', name: 'chill_calendar_calendar_list_by_period')] public function listActionByCourse(AccompanyingPeriod $accompanyingPeriod): Response { $this->denyAccessUnlessGranted(CalendarVoter::SEE, $accompanyingPeriod); @@ -228,9 +225,8 @@ class CalendarController extends AbstractController /** * Lists all Calendar entities on a person. - * - * @Route("/{_locale}/calendar/calendar/by-person/{id}", name="chill_calendar_calendar_list_by_person") */ + #[Route(path: '/{_locale}/calendar/calendar/by-person/{id}', name: 'chill_calendar_calendar_list_by_person')] public function listActionByPerson(Person $person): Response { $this->denyAccessUnlessGranted(CalendarVoter::SEE, $person); @@ -260,9 +256,7 @@ class CalendarController extends AbstractController ]); } - /** - * @Route("/{_locale}/calendar/calendar/my", name="chill_calendar_calendar_list_my") - */ + #[Route(path: '/{_locale}/calendar/calendar/my', name: 'chill_calendar_calendar_list_my')] public function myCalendar(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_USER'); @@ -284,9 +278,8 @@ class CalendarController extends AbstractController /** * Create a new calendar item. - * - * @Route("/{_locale}/calendar/calendar/new", name="chill_calendar_calendar_new") */ + #[Route(path: '/{_locale}/calendar/calendar/new', name: 'chill_calendar_calendar_new')] public function newAction(Request $request): Response { if (!$this->remoteCalendarConnector->isReady()) { @@ -385,9 +378,8 @@ class CalendarController extends AbstractController /** * Show a calendar item. - * - * @Route("/{_locale}/calendar/calendar/{id}/show", name="chill_calendar_calendar_show") */ + #[Route(path: '/{_locale}/calendar/calendar/{id}/show', name: 'chill_calendar_calendar_show')] public function showAction(Request $request, int $id): Response { throw new \Exception('not implemented'); @@ -455,9 +447,7 @@ class CalendarController extends AbstractController ]); } - /** - * @Route("/{_locale}/calendar/calendar/{id}/to-activity", name="chill_calendar_calendar_to_activity") - */ + #[Route(path: '/{_locale}/calendar/calendar/{id}/to-activity', name: 'chill_calendar_calendar_to_activity')] public function toActivity(Request $request, Calendar $calendar): RedirectResponse { $this->denyAccessUnlessGranted(CalendarVoter::SEE, $calendar); diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php index d0f5e623d..3afe0915d 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarDocController.php @@ -37,9 +37,7 @@ final readonly class CalendarDocController private UrlGeneratorInterface $urlGenerator, ) {} - /** - * @Route("/{_locale}/calendar/calendar-doc/{id}/new", name="chill_calendar_calendardoc_new") - */ + #[Route(path: '/{_locale}/calendar/calendar-doc/{id}/new', name: 'chill_calendar_calendardoc_new')] public function create(Calendar $calendar, Request $request): Response { $calendarDoc = (new CalendarDoc($calendar, null))->setCalendar($calendar); @@ -96,9 +94,7 @@ final readonly class CalendarDocController ); } - /** - * @Route("/{_locale}/calendar/calendar-doc/{id}/delete", name="chill_calendar_calendardoc_delete") - */ + #[Route(path: '/{_locale}/calendar/calendar-doc/{id}/delete', name: 'chill_calendar_calendardoc_delete')] public function delete(CalendarDoc $calendarDoc, Request $request): Response { if (!$this->security->isGranted(CalendarDocVoter::EDIT, $calendarDoc)) { @@ -156,9 +152,7 @@ final readonly class CalendarDocController ); } - /** - * @Route("/{_locale}/calendar/calendar-doc/{id}/edit", name="chill_calendar_calendardoc_edit") - */ + #[Route(path: '/{_locale}/calendar/calendar-doc/{id}/edit', name: 'chill_calendar_calendardoc_edit')] public function edit(CalendarDoc $calendarDoc, Request $request): Response { if (!$this->security->isGranted(CalendarDocVoter::EDIT, $calendarDoc)) { diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php index 459d8f6aa..3774f4226 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php @@ -25,12 +25,7 @@ class CalendarRangeAPIController extends ApiController { public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository) {} - /** - * @Route("/api/1.0/calendar/calendar-range-available/{id}.{_format}", - * name="chill_api_single_calendar_range_available", - * requirements={"_format": "json"} - * ) - */ + #[Route(path: '/api/1.0/calendar/calendar-range-available/{id}.{_format}', name: 'chill_api_single_calendar_range_available', requirements: ['_format' => 'json'])] public function availableRanges(User $user, Request $request, string $_format): JsonResponse { // return new JsonResponse(['ok' => true], 200, [], false); diff --git a/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php b/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php index 784a6f6ce..8b0337e14 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php @@ -38,9 +38,8 @@ class InviteApiController /** * Give an answer to a calendar invite. - * - * @Route("/api/1.0/calendar/calendar/{id}/answer/{answer}.json", methods={"post"}) */ + #[Route(path: '/api/1.0/calendar/calendar/{id}/answer/{answer}.json', methods: ['post'])] public function answer(Calendar $calendar, string $answer): Response { $user = $this->security->getUser(); diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php index 75b417e93..8790617ed 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarConnectAzureController.php @@ -32,9 +32,7 @@ class RemoteCalendarConnectAzureController { public function __construct(private readonly ClientRegistry $clientRegistry, private readonly OnBehalfOfUserTokenStorage $MSGraphTokenStorage) {} - /** - * @Route("/{_locale}/connect/azure", name="chill_calendar_remote_connect_azure") - */ + #[Route(path: '/{_locale}/connect/azure', name: 'chill_calendar_remote_connect_azure')] public function connectAzure(Request $request): Response { $request->getSession()->set('azure_return_path', $request->query->get('returnPath', '/')); @@ -44,9 +42,7 @@ class RemoteCalendarConnectAzureController ->redirect(['https://graph.microsoft.com/.default', 'offline_access'], []); } - /** - * @Route("/connect/azure/check", name="chill_calendar_remote_connect_azure_check") - */ + #[Route(path: '/connect/azure/check', name: 'chill_calendar_remote_connect_azure_check')] public function connectAzureCheck(Request $request): Response { /** @var Azure $client */ diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php index e7d423abd..3faefeb00 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarMSGraphSyncController.php @@ -29,10 +29,7 @@ class RemoteCalendarMSGraphSyncController { public function __construct(private readonly MessageBusInterface $messageBus) {} - /** - * @Route("/public/incoming-hook/calendar/msgraph/events/{userId}", name="chill_calendar_remote_msgraph_incoming_webhook_events", - * methods={"POST"}) - */ + #[Route(path: '/public/incoming-hook/calendar/msgraph/events/{userId}', name: 'chill_calendar_remote_msgraph_incoming_webhook_events', methods: ['POST'])] public function webhookCalendarReceiver(int $userId, Request $request): Response { if ($request->query->has('validationToken')) { diff --git a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php index 673912c0a..647c6e444 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/RemoteCalendarProxyController.php @@ -36,9 +36,7 @@ class RemoteCalendarProxyController { public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly SerializerInterface $serializer) {} - /** - * @Route("api/1.0/calendar/proxy/calendar/by-user/{id}/events") - */ + #[Route(path: 'api/1.0/calendar/proxy/calendar/by-user/{id}/events')] public function listEventForCalendar(User $user, Request $request): Response { if (!$request->query->has('dateFrom')) { diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php index 32308a50c..38a7e29f0 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php @@ -43,11 +43,8 @@ use Symfony\Component\Validator\Mapping\ClassMetadata; * ) * * @ORM\Entity - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "chill_calendar_calendar": Calendar::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_calendar_calendar' => Calendar::class])] class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCentersInterface { use RemoteCalendarTrait; @@ -91,9 +88,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente /** * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod", inversedBy="calendars") - * - * @Serializer\Groups({"calendar:read", "read"}) */ + #[Serializer\Groups(['calendar:read', 'read'])] private ?AccompanyingPeriod $accompanyingPeriod = null; /** @@ -103,9 +99,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente /** * @ORM\OneToOne(targetEntity="CalendarRange", inversedBy="calendar") - * - * @Serializer\Groups({"calendar:read", "read"}) */ + #[Serializer\Groups(['calendar:read', 'read'])] private ?CalendarRange $calendarRange = null; /** @@ -115,9 +110,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente /** * @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_") - * - * @Serializer\Groups({"calendar:read", "read", "docgen:read"}) */ + #[Serializer\Groups(['calendar:read', 'read', 'docgen:read'])] private CommentEmbeddable $comment; /** @@ -134,11 +128,9 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente /** * @ORM\Column(type="datetime_immutable", nullable=false) - * - * @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"}) - * - * @Assert\NotNull(message="calendar.An end date is required") */ + #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] + #[Assert\NotNull(message: 'calendar.An end date is required')] private ?\DateTimeImmutable $endDate = null; /** @@ -147,9 +139,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"}) */ + #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] private ?int $id = null; /** @@ -162,30 +153,25 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente * * @ORM\JoinTable(name="chill_calendar.calendar_to_invites") * - * @Serializer\Groups({"read", "docgen:read"}) - * * @var Collection&Selectable */ + #[Serializer\Groups(['read', 'docgen:read'])] private Collection&Selectable $invites; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location") - * - * @Serializer\Groups({"read", "docgen:read"}) - * - * @Assert\NotNull(message="calendar.A location is required") */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[Assert\NotNull(message: 'calendar.A location is required')] private ?Location $location = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") * - * @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"}) - * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) - * - * @Assert\NotNull(message="calendar.A main user is mandatory") */ + #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] + #[Assert\NotNull(message: 'calendar.A main user is mandatory')] private ?User $mainUser = null; /** @@ -200,21 +186,18 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente * * @ORM\JoinTable(name="chill_calendar.calendar_to_persons") * - * @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"}) - * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) * - * @Assert\Count(min=1, minMessage="calendar.At least {{ limit }} person is required.") - * * @var Collection */ + #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] + #[Assert\Count(min: 1, minMessage: 'calendar.At least {{ limit }} person is required.')] private Collection $persons; /** * @ORM\Embedded(class=PrivateCommentEmbeddable::class, columnPrefix="privateComment_") - * - * @Serializer\Groups({"calendar:read"}) */ + #[Serializer\Groups(['calendar:read'])] private PrivateCommentEmbeddable $privateComment; /** @@ -224,17 +207,15 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente * * @ORM\JoinTable(name="chill_calendar.calendar_to_thirdparties") * - * @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"}) - * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) */ + #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] private Collection $professionals; /** * @ORM\Column(type="boolean", nullable=true) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?bool $sendSMS = false; /** @@ -245,28 +226,24 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente /** * @ORM\Column(type="datetime_immutable", nullable=false) * - * @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"}) - * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) - * - * @Assert\NotNull(message="calendar.A start date is required") */ + #[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])] + #[Assert\NotNull(message: 'calendar.A start date is required')] private ?\DateTimeImmutable $startDate = null; /** * @ORM\Column(type="string", length=255, nullable=false, options={"default": "valid"}) * - * @Serializer\Groups({"calendar:read", "read", "calendar:light"}) - * * @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"}) */ + #[Serializer\Groups(['calendar:read', 'read', 'calendar:light'])] private string $status = self::STATUS_VALID; /** * @ORM\Column(type="boolean", nullable=true) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?bool $urgent = false; public function __construct() @@ -394,9 +371,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente return $this->documents; } - /** - * @Serializer\Groups({"docgen:read"}) - */ + #[Serializer\Groups(['docgen:read'])] public function getDuration(): ?\DateInterval { if (null === $this->getStartDate() || null === $this->getEndDate()) { @@ -541,9 +516,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente /** * @return ReadableCollection<(int|string), User> - * - * @Serializer\Groups({"calendar:read", "read"}) */ + #[Serializer\Groups(['calendar:read', 'read'])] public function getUsers(): ReadableCollection { return $this->getInvites()->map(static fn (Invite $i) => $i->getUser()); diff --git a/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc/CalendarDocCreateDTO.php b/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc/CalendarDocCreateDTO.php index ff4e10402..16c0e9105 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc/CalendarDocCreateDTO.php +++ b/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc/CalendarDocCreateDTO.php @@ -16,17 +16,11 @@ use Symfony\Component\Validator\Constraints as Assert; class CalendarDocCreateDTO { - /** - * @Assert\NotNull - * - * @Assert\Valid - */ + #[Assert\NotNull] + #[Assert\Valid] public ?StoredObject $doc = null; - /** - * @Assert\NotBlank - * - * @Assert\NotNull - */ + #[Assert\NotBlank] + #[Assert\NotNull] public ?string $title = ''; } diff --git a/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc/CalendarDocEditDTO.php b/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc/CalendarDocEditDTO.php index 2e8970db6..38276b0f3 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc/CalendarDocEditDTO.php +++ b/src/Bundle/ChillCalendarBundle/Entity/CalendarDoc/CalendarDocEditDTO.php @@ -17,16 +17,11 @@ use Symfony\Component\Validator\Constraints as Assert; class CalendarDocEditDTO { - /** - * @Assert\Valid - */ + #[Assert\Valid] public ?StoredObject $doc = null; - /** - * @Assert\NotBlank - * - * @Assert\NotNull - */ + #[Assert\NotBlank] + #[Assert\NotNull] public ?string $title = ''; public function __construct(CalendarDoc $calendarDoc) diff --git a/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php b/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php index 0c46db57c..3e2cf1eb0 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php +++ b/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php @@ -44,11 +44,9 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="datetime_immutable", nullable=false) - * - * @Groups({"read", "write", "calendar:read"}) - * - * @Assert\NotNull */ + #[Groups(['read', 'write', 'calendar:read'])] + #[Assert\NotNull] private ?\DateTimeImmutable $endDate = null; /** @@ -57,38 +55,31 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?int $id = null; /** * @ORM\ManyToOne(targetEntity=Location::class) * * @ORM\JoinColumn(nullable=false) - * - * @Groups({"read", "write", "calendar:read"}) - * - * @Assert\NotNull */ + #[Groups(['read', 'write', 'calendar:read'])] + #[Assert\NotNull] private ?Location $location = null; /** * @ORM\Column(type="datetime_immutable", nullable=false) - * - * @groups({"read", "write", "calendar:read"}) - * - * @Assert\NotNull */ + #[Groups(['read', 'write', 'calendar:read'])] + #[Assert\NotNull] private ?\DateTimeImmutable $startDate = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") - * - * @Groups({"read", "write", "calendar:read"}) - * - * @Assert\NotNull */ + #[Groups(['read', 'write', 'calendar:read'])] + #[Assert\NotNull] private ?User $user = null; public function getCalendar(): ?Calendar diff --git a/src/Bundle/ChillCalendarBundle/Entity/Invite.php b/src/Bundle/ChillCalendarBundle/Entity/Invite.php index 48fe865b0..40024c52d 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Invite.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Invite.php @@ -69,25 +69,22 @@ class Invite implements TrackUpdateInterface, TrackCreationInterface * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups(groups={"calendar:read", "read"}) */ + #[Serializer\Groups(groups: ['calendar:read', 'read'])] private ?int $id = null; /** * @ORM\Column(type="text", nullable=false, options={"default": "pending"}) - * - * @Serializer\Groups(groups={"calendar:read", "read", "docgen:read"}) */ + #[Serializer\Groups(groups: ['calendar:read', 'read', 'docgen:read'])] private string $status = self::PENDING; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") * * @ORM\JoinColumn(nullable=false) - * - * @Serializer\Groups(groups={"calendar:read", "read", "docgen:read"}) */ + #[Serializer\Groups(groups: ['calendar:read', 'read', 'docgen:read'])] private ?User $user = null; public function getCalendar(): ?Calendar diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php index 40d1d1435..8da4e74d7 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Model/RemoteEvent.php @@ -23,26 +23,16 @@ use Symfony\Component\Serializer\Annotation as Serializer; class RemoteEvent { public function __construct( - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public string $id, - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public string $title, public string $description, - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public \DateTimeImmutable $startDate, - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public \DateTimeImmutable $endDate, - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public bool $isAllDay = false ) {} } diff --git a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php index de3f0cf5b..24c531860 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php +++ b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php @@ -31,6 +31,7 @@ use Symfony\Component\Yaml\Parser; */ class CreateFieldsOnGroupCommand extends Command { + protected static $defaultDescription = 'Create custom fields from a yml file'; final public const ARG_DELETE = 'delete'; final public const ARG_PATH = 'path'; @@ -51,7 +52,6 @@ class CreateFieldsOnGroupCommand extends Command protected function configure() { $this->setName('chill:custom_fields:populate_group') - ->setDescription('Create custom fields from a yml file') ->addArgument( self::ARG_PATH, InputOption::VALUE_REQUIRED, @@ -130,7 +130,7 @@ class CreateFieldsOnGroupCommand extends Command $fields = $this->_addFields($customFieldsGroup, $fieldsInput, $output); - return 0; + return Command::SUCCESS; } private function _addFields(CustomFieldsGroup $group, $values, OutputInterface $output) diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/AdminController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/AdminController.php index eda55bb87..525df57ee 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/AdminController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/AdminController.php @@ -21,9 +21,7 @@ use Symfony\Component\Routing\Annotation\Route; */ class AdminController extends AbstractController { - /** - * @Route("/{_locale}/admin/customfield/", name="customfield_section") - */ + #[Route(path: '/{_locale}/admin/customfield/', name: 'customfield_section')] public function indexAction(): Response { return $this->render('@ChillCustomFields/Admin/layout.html.twig'); diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php index 85b5d9261..39d9821a9 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php @@ -33,9 +33,8 @@ class CustomFieldController extends AbstractController /** * Creates a new CustomField entity. - * - * @Route("/{_locale}/admin/customfield/new", name="customfield_create") */ + #[Route(path: '/{_locale}/admin/customfield/new', name: 'customfield_create')] public function createAction(Request $request) { $entity = new CustomField(); @@ -64,9 +63,8 @@ class CustomFieldController extends AbstractController /** * Displays a form to edit an existing CustomField entity. - * - * @Route("/{_locale}/admin/customfield/edit", name="customfield_edit") */ + #[Route(path: '/{_locale}/admin/customfield/edit', name: 'customfield_edit')] public function editAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -87,9 +85,8 @@ class CustomFieldController extends AbstractController /** * Displays a form to create a new CustomField entity. - * - * @Route("/{_locale}/admin/customfield/new", name="customfield_new") */ + #[Route(path: '/{_locale}/admin/customfield/new', name: 'customfield_new')] public function newAction(Request $request) { $entity = new CustomField(); @@ -118,9 +115,8 @@ class CustomFieldController extends AbstractController /** * Edits an existing CustomField entity. - * - * @Route("/{_locale}/admin/customfield/update", name="customfield_update") */ + #[Route(path: '/{_locale}/admin/customfield/update', name: 'customfield_update')] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php index 92a13eb0f..5d16269e6 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php +++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php @@ -44,9 +44,8 @@ class CustomFieldsGroupController extends AbstractController /** * Creates a new CustomFieldsGroup entity. - * - * @Route("/{_locale}/admin/customfieldsgroup/create", name="customfieldsgroup_create") */ + #[Route(path: '/{_locale}/admin/customfieldsgroup/create', name: 'customfieldsgroup_create')] public function createAction(Request $request) { $entity = new CustomFieldsGroup(); @@ -75,9 +74,8 @@ class CustomFieldsGroupController extends AbstractController /** * Displays a form to edit an existing CustomFieldsGroup entity. - * - * @Route("/{_locale}/admin/customfieldsgroup/{id}/edit", name="customfieldsgroup_edit") */ + #[Route(path: '/{_locale}/admin/customfieldsgroup/{id}/edit', name: 'customfieldsgroup_edit')] public function editAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -98,9 +96,8 @@ class CustomFieldsGroupController extends AbstractController /** * Lists all CustomFieldsGroup entities. - * - * @Route("/{_locale}/admin/customfieldsgroup/", name="customfieldsgroup") */ + #[Route(path: '/{_locale}/admin/customfieldsgroup/', name: 'customfieldsgroup')] public function indexAction() { $em = $this->managerRegistry->getManager(); @@ -125,9 +122,8 @@ class CustomFieldsGroupController extends AbstractController /** * Set the CustomField Group with id $cFGroupId as default. - * - * @Route("/{_locale}/admin/customfieldsgroup/makedefault", name="customfieldsgroup_makedefault") */ + #[Route(path: '/{_locale}/admin/customfieldsgroup/makedefault', name: 'customfieldsgroup_makedefault')] public function makeDefaultAction(Request $request) { $form = $this->createMakeDefaultForm(null); @@ -170,9 +166,8 @@ class CustomFieldsGroupController extends AbstractController /** * Displays a form to create a new CustomFieldsGroup entity. - * - * @Route("/{_locale}/admin/customfieldsgroup/new", name="customfieldsgroup_new") */ + #[Route(path: '/{_locale}/admin/customfieldsgroup/new', name: 'customfieldsgroup_new')] public function newAction() { $entity = new CustomFieldsGroup(); @@ -235,9 +230,8 @@ class CustomFieldsGroupController extends AbstractController /** * Finds and displays a CustomFieldsGroup entity. - * - * @Route("/{_locale}/admin/customfieldsgroup/{id}/show", name="customfieldsgroup_show") */ + #[Route(path: '/{_locale}/admin/customfieldsgroup/{id}/show', name: 'customfieldsgroup_show')] public function showAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -259,9 +253,8 @@ class CustomFieldsGroupController extends AbstractController /** * Edits an existing CustomFieldsGroup entity. - * - * @Route("/{_locale}/admin/customfieldsgroup/{id}/update", name="customfieldsgroup_update") */ + #[Route(path: '/{_locale}/admin/customfieldsgroup/{id}/update', name: 'customfieldsgroup_update')] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php index ecb896080..04fa9ce07 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php @@ -58,9 +58,7 @@ class AdminDocGeneratorTemplateController extends CRUDController return parent::new($request); } - /** - * @Route("{_locale}/admin/docgen/template/pick-context", name="chill_docgen_admin_template_pick-context") - */ + #[Route(path: '{_locale}/admin/docgen/template/pick-context', name: 'chill_docgen_admin_template_pick-context')] public function pickContext(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_ADMIN'); diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php index 08470778a..dfb70d1c8 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php @@ -51,12 +51,7 @@ final class DocGeneratorTemplateController extends AbstractController private readonly ChillSecurity $security ) {} - /** - * @Route( - * "{_locale}/admin/doc/gen/generate/test/from/{template}/for/{entityClassName}/{entityId}", - * name="chill_docgenerator_test_generate_from_template" - * ) - */ + #[Route(path: '{_locale}/admin/doc/gen/generate/test/from/{template}/for/{entityClassName}/{entityId}', name: 'chill_docgenerator_test_generate_from_template')] public function adminTestGenerateDocFromTemplateAction( DocGeneratorTemplate $template, string $entityClassName, @@ -71,12 +66,7 @@ final class DocGeneratorTemplateController extends AbstractController ); } - /** - * @Route( - * "{_locale}/doc/gen/generate/from/{template}/for/{entityClassName}/{entityId}", - * name="chill_docgenerator_generate_from_template" - * ) - */ + #[Route(path: '{_locale}/doc/gen/generate/from/{template}/for/{entityClassName}/{entityId}', name: 'chill_docgenerator_generate_from_template')] public function generateDocFromTemplateAction( DocGeneratorTemplate $template, string $entityClassName, @@ -91,12 +81,7 @@ final class DocGeneratorTemplateController extends AbstractController ); } - /** - * @Route( - * "/api/1.0/docgen/templates/by-entity/{entityClassName}", - * name="chill_docgenerator_templates_for_entity_api" - * ) - */ + #[Route(path: '/api/1.0/docgen/templates/by-entity/{entityClassName}', name: 'chill_docgenerator_templates_for_entity_api')] public function listTemplateApiAction(string $entityClassName): Response { $nb = $this->docGeneratorTemplateRepository->countByEntity($entityClassName); @@ -116,13 +101,9 @@ final class DocGeneratorTemplateController extends AbstractController } /** - * @Route( - * "{_locale}/admin/doc/gen/generate/test/redirect", - * name="chill_docgenerator_test_generate_redirect" - * ) - * * @return void */ + #[Route(path: '{_locale}/admin/doc/gen/generate/test/redirect', name: 'chill_docgenerator_test_generate_redirect')] public function redirectToTestGenerate(Request $request): RedirectResponse { $template = $request->query->getInt('template'); diff --git a/src/Bundle/ChillDocGeneratorBundle/Entity/DocGeneratorTemplate.php b/src/Bundle/ChillDocGeneratorBundle/Entity/DocGeneratorTemplate.php index e2524e5ba..857b0f5b5 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Entity/DocGeneratorTemplate.php +++ b/src/Bundle/ChillDocGeneratorBundle/Entity/DocGeneratorTemplate.php @@ -19,11 +19,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table(name="chill_docgen_template") - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "docgen_template": DocGeneratorTemplate::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['docgen_template' => DocGeneratorTemplate::class])] class DocGeneratorTemplate { /** @@ -43,9 +40,8 @@ class DocGeneratorTemplate /** * @ORM\Column(type="text", nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?string $description = null; /** @@ -66,16 +62,14 @@ class DocGeneratorTemplate * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?int $id = null; /** * @ORM\Column(type="json") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private array $name = []; /** diff --git a/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Normalizer/DocGenObjectNormalizerTest.php b/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Normalizer/DocGenObjectNormalizerTest.php index 542e44973..ad438ba2b 100644 --- a/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Normalizer/DocGenObjectNormalizerTest.php +++ b/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Normalizer/DocGenObjectNormalizerTest.php @@ -238,10 +238,9 @@ final class DocGenObjectNormalizerTest extends KernelTestCase class TestableParentClass { /** - * @Serializer\Groups("docgen:read") - * * @Serializer\Context(normalizationContext={"groups": "docgen:read:foo"}, groups={"docgen:read"}) */ + #[Serializer\Groups('docgen:read')] public ?TestableChildClass $child; public function __construct() @@ -252,27 +251,19 @@ class TestableParentClass class TestableChildClass { - /** - * @Serializer\Groups("docgen:read") - */ + #[Serializer\Groups('docgen:read')] public string $baz = 'bloup'; - /** - * @Serializer\Groups("docgen:read:foo") - */ + #[Serializer\Groups('docgen:read:foo')] public string $foo = 'bar'; } class TestableClassWithBool { - /** - * @Serializer\Groups("docgen:read") - */ + #[Serializer\Groups('docgen:read')] public bool $foo; - /** - * @Serializer\Groups("docgen:read") - */ + #[Serializer\Groups('docgen:read')] public function getThing(): bool { return true; @@ -281,9 +272,7 @@ class TestableClassWithBool class TestableWithIntersectionReadableCollection { - /** - * @Serializer\Groups("docgen:read") - */ + #[Serializer\Groups('docgen:read')] public ReadableCollection&Selectable $collection; public function __construct() @@ -294,9 +283,7 @@ class TestableWithIntersectionReadableCollection class TestableWithCollection { - /** - * @Serializer\Groups("docgen:read") - */ + #[Serializer\Groups('docgen:read')] public Collection&Selectable $collection; public function __construct() diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Command/ConfigureOpenstackObjectStorageCommand.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Command/ConfigureOpenstackObjectStorageCommand.php index de6690faf..fd1b41481 100644 --- a/src/Bundle/ChillDocStoreBundle/AsyncUpload/Command/ConfigureOpenstackObjectStorageCommand.php +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/Command/ConfigureOpenstackObjectStorageCommand.php @@ -21,6 +21,7 @@ use Symfony\Contracts\HttpClient\HttpClientInterface; class ConfigureOpenstackObjectStorageCommand extends Command { + protected static $defaultDescription = 'Configure openstack container to store documents'; private readonly string $basePath; private readonly string $tempUrlKey; @@ -37,7 +38,7 @@ class ConfigureOpenstackObjectStorageCommand extends Command protected function configure() { - $this->setDescription('Configure openstack container to store documents') + $this ->setName('chill:doc-store:configure-openstack') ->addOption('os_token', 'o', InputOption::VALUE_REQUIRED, 'Openstack token') ->addOption('domain', 'd', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Domain name') @@ -85,6 +86,6 @@ class ConfigureOpenstackObjectStorageCommand extends Command } } - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrl.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrl.php index 9003a69ea..aba289652 100644 --- a/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrl.php +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrl.php @@ -16,21 +16,14 @@ use Symfony\Component\Serializer\Annotation as Serializer; readonly class SignedUrl { public function __construct( - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public string $method, - - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public string $url, public \DateTimeImmutable $expires, ) {} - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public function getExpires(): int { return $this->expires->getTimestamp(); diff --git a/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrlPost.php b/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrlPost.php index 4a5b4e0fb..9d37771d1 100644 --- a/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrlPost.php +++ b/src/Bundle/ChillDocStoreBundle/AsyncUpload/SignedUrlPost.php @@ -18,35 +18,17 @@ readonly class SignedUrlPost extends SignedUrl public function __construct( string $url, \DateTimeImmutable $expires, - - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public int $max_file_size, - - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public int $max_file_count, - - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public int $submit_delay, - - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public string $redirect, - - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public string $prefix, - - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public string $signature, ) { parent::__construct('POST', $url, $expires); diff --git a/src/Bundle/ChillDocStoreBundle/Controller/AdminController.php b/src/Bundle/ChillDocStoreBundle/Controller/AdminController.php index 31c80158e..1ad892891 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/AdminController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/AdminController.php @@ -20,9 +20,8 @@ class AdminController extends AbstractController { /** * @return \Symfony\Component\HttpFoundation\Response - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/document", name="chill_docstore_admin", options={null}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/document', name: 'chill_docstore_admin', options: [null])] public function indexAction() { return $this->render('@ChillDocStore/Admin/layout.html.twig'); @@ -30,9 +29,8 @@ class AdminController extends AbstractController /** * @return \Symfony\Component\HttpFoundation\RedirectResponse - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/document_redirect_to_main", name="chill_docstore_admin_redirect_to_admin_index", options={null}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/document_redirect_to_main', name: 'chill_docstore_admin_redirect_to_admin_index', options: [null])] public function redirectToAdminIndexAction() { return $this->redirectToRoute('chill_main_admin_central'); diff --git a/src/Bundle/ChillDocStoreBundle/Controller/AsyncUploadController.php b/src/Bundle/ChillDocStoreBundle/Controller/AsyncUploadController.php index decfde596..75be20d34 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/AsyncUploadController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/AsyncUploadController.php @@ -33,10 +33,7 @@ final readonly class AsyncUploadController private LoggerInterface $logger, ) {} - /** - * @Route("/asyncupload/temp_url/generate/{method}", - * name="async_upload.generate_url") - */ + #[Route(path: '/asyncupload/temp_url/generate/{method}', name: 'async_upload.generate_url')] public function getSignedUrl(string $method, Request $request): JsonResponse { try { diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php index c7f6e1920..a281fc663 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php @@ -25,9 +25,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; use Symfony\Contracts\Translation\TranslatorInterface; -/** - * @Route("/{_locale}/parcours/{course}/document") - */ +#[Route(path: '/{_locale}/parcours/{course}/document')] class DocumentAccompanyingCourseController extends AbstractController { /** @@ -40,9 +38,7 @@ class DocumentAccompanyingCourseController extends AbstractController private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry ) {} - /** - * @Route("/{id}/delete", name="chill_docstore_accompanying_course_document_delete") - */ + #[Route(path: '/{id}/delete', name: 'chill_docstore_accompanying_course_document_delete')] public function delete(Request $request, AccompanyingPeriod $course, AccompanyingCourseDocument $document): Response { $this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::DELETE, $document); @@ -75,9 +71,7 @@ class DocumentAccompanyingCourseController extends AbstractController ); } - /** - * @Route("/{id}/edit", name="accompanying_course_document_edit", methods="GET|POST") - */ + #[Route(path: '/{id}/edit', name: 'accompanying_course_document_edit', methods: 'GET|POST')] public function edit(Request $request, AccompanyingPeriod $course, AccompanyingCourseDocument $document): Response { $this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::UPDATE, $document); @@ -116,9 +110,7 @@ class DocumentAccompanyingCourseController extends AbstractController ); } - /** - * @Route("/new", name="accompanying_course_document_new", methods="GET|POST") - */ + #[Route(path: '/new', name: 'accompanying_course_document_new', methods: 'GET|POST')] public function new(Request $request, AccompanyingPeriod $course): Response { if (null === $course) { @@ -162,9 +154,7 @@ class DocumentAccompanyingCourseController extends AbstractController ]); } - /** - * @Route("/{id}", name="accompanying_course_document_show", methods="GET") - */ + #[Route(path: '/{id}', name: 'accompanying_course_document_show', methods: 'GET')] public function show(AccompanyingPeriod $course, AccompanyingCourseDocument $document): Response { $this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::SEE_DETAILS, $document); diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php index 7803f24e4..e67ac9751 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentCategoryController.php @@ -20,16 +20,12 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/{_locale}/admin/document/category") - */ +#[Route(path: '/{_locale}/admin/document/category')] class DocumentCategoryController extends AbstractController { public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} - /** - * @Route("/{bundleId}/{idInsideBundle}", name="document_category_delete", methods="DELETE") - */ + #[Route(path: '/{bundleId}/{idInsideBundle}', name: 'document_category_delete', methods: 'DELETE')] public function delete(Request $request, mixed $bundleId, mixed $idInsideBundle): Response { $em = $this->managerRegistry->getManager(); @@ -47,9 +43,7 @@ class DocumentCategoryController extends AbstractController return $this->redirectToRoute('document_category_index'); } - /** - * @Route("/{bundleId}/{idInsideBundle}/edit", name="document_category_edit", methods="GET|POST") - */ + #[Route(path: '/{bundleId}/{idInsideBundle}/edit', name: 'document_category_edit', methods: 'GET|POST')] public function edit(Request $request, mixed $bundleId, mixed $idInsideBundle): Response { $em = $this->managerRegistry->getManager(); @@ -76,9 +70,8 @@ class DocumentCategoryController extends AbstractController ]); } - /** - * @Route("/", name="document_category_index", methods="GET") - * @Route("/", name="chill_docstore_category_admin", methods="GET") */ + #[Route(path: '/', name: 'document_category_index', methods: 'GET')] + #[Route(path: '/', name: 'chill_docstore_category_admin', methods: 'GET')] public function index(): Response { $em = $this->managerRegistry->getManager(); @@ -92,9 +85,7 @@ class DocumentCategoryController extends AbstractController ); } - /** - * @Route("/new", name="document_category_new", methods="GET|POST") - */ + #[Route(path: '/new', name: 'document_category_new', methods: 'GET|POST')] public function new(Request $request): Response { $em = $this->managerRegistry->getManager(); @@ -130,9 +121,7 @@ class DocumentCategoryController extends AbstractController ]); } - /** - * @Route("/{bundleId}/{idInsideBundle}", name="document_category_show", methods="GET") - */ + #[Route(path: '/{bundleId}/{idInsideBundle}', name: 'document_category_show', methods: 'GET')] public function show(mixed $bundleId, mixed $idInsideBundle): Response { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php index 3c93acf5c..ad58b6e0c 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php @@ -29,11 +29,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; /** * Class DocumentPersonController. - * - * @Route("/{_locale}/person/{person}/document") - * - * TODO faire un controller abstrait ? */ +#[Route(path: '/{_locale}/person/{person}/document')] // TODO faire un controller abstrait ? class DocumentPersonController extends AbstractController { /** @@ -46,9 +43,7 @@ class DocumentPersonController extends AbstractController private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry ) {} - /** - * @Route("/{id}/delete", name="chill_docstore_person_document_delete") - */ + #[Route(path: '/{id}/delete', name: 'chill_docstore_person_document_delete')] public function delete(Request $request, Person $person, PersonDocument $document): Response { $this->denyAccessUnlessGranted(PersonDocumentVoter::DELETE, $document); @@ -81,9 +76,7 @@ class DocumentPersonController extends AbstractController ); } - /** - * @Route("/{id}/edit", name="person_document_edit", methods="GET|POST") - */ + #[Route(path: '/{id}/edit', name: 'person_document_edit', methods: 'GET|POST')] public function edit(Request $request, Person $person, PersonDocument $document): Response { $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person); @@ -140,9 +133,7 @@ class DocumentPersonController extends AbstractController ); } - /** - * @Route("/new", name="person_document_new", methods="GET|POST") - */ + #[Route(path: '/new', name: 'person_document_new', methods: 'GET|POST')] public function new(Request $request, Person $person): Response { if (null === $person) { @@ -188,9 +179,7 @@ class DocumentPersonController extends AbstractController ]); } - /** - * @Route("/{id}", name="person_document_show", methods="GET") - */ + #[Route(path: '/{id}', name: 'person_document_show', methods: 'GET')] public function show(Person $person, PersonDocument $document): Response { $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person); diff --git a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php index e615c3b00..f68158552 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForAccompanyingPeriodController.php @@ -33,9 +33,8 @@ final readonly class GenericDocForAccompanyingPeriodController /** * @throws \Doctrine\DBAL\Exception - * - * @Route("/{_locale}/doc-store/generic-doc/by-period/{id}/index", name="chill_docstore_generic-doc_by-period_index") */ + #[Route(path: '/{_locale}/doc-store/generic-doc/by-period/{id}/index', name: 'chill_docstore_generic-doc_by-period_index')] public function list(AccompanyingPeriod $accompanyingPeriod): Response { if (!$this->security->isGranted(AccompanyingCourseDocumentVoter::SEE, $accompanyingPeriod)) { diff --git a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php index f6fecae04..c47b2c02a 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/GenericDocForPerson.php @@ -33,9 +33,8 @@ final readonly class GenericDocForPerson /** * @throws \Doctrine\DBAL\Exception - * - * @Route("/{_locale}/doc-store/generic-doc/by-person/{id}/index", name="chill_docstore_generic-doc_by-person_index") */ + #[Route(path: '/{_locale}/doc-store/generic-doc/by-person/{id}/index', name: 'chill_docstore_generic-doc_by-person_index')] public function list(Person $person): Response { if (!$this->security->isGranted(PersonDocumentVoter::SEE, $person)) { diff --git a/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php b/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php index 5a4b90474..38856b779 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/StoredObjectApiController.php @@ -22,9 +22,7 @@ class StoredObjectApiController { public function __construct(private readonly Security $security) {} - /** - * @Route("/api/1.0/doc-store/stored-object/{uuid}/is-ready") - */ + #[Route(path: '/api/1.0/doc-store/stored-object/{uuid}/is-ready')] public function isDocumentReady(StoredObject $storedObject): Response { if (!$this->security->isGranted('ROLE_USER')) { diff --git a/src/Bundle/ChillDocStoreBundle/Entity/Document.php b/src/Bundle/ChillDocStoreBundle/Entity/Document.php index a56b6b800..2ffe06122 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/Document.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/Document.php @@ -54,13 +54,9 @@ class Document implements TrackCreationInterface, TrackUpdateInterface * targetEntity="Chill\DocStoreBundle\Entity\StoredObject", * cascade={"persist"} * ) - * - * @Assert\Valid - * - * @Assert\NotNull( - * message="Upload a document" - * ) */ + #[Assert\Valid] + #[Assert\NotNull(message: 'Upload a document')] private ?StoredObject $object = null; /** @@ -70,11 +66,8 @@ class Document implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="text") - * - * @Assert\Length( - * min=2, max=250 - * ) */ + #[Assert\Length(min: 2, max: 250)] private string $title = ''; /** diff --git a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php index 52fc35951..8d3046ac7 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php @@ -46,16 +46,14 @@ class StoredObject implements Document, TrackCreationInterface /** * @ORM\Column(type="json", name="datas") - * - * @Serializer\Groups({"read", "write"}) */ + #[Serializer\Groups(['read', 'write'])] private array $datas = []; /** * @ORM\Column(type="text") - * - * @Serializer\Groups({"read", "write"}) */ + #[Serializer\Groups(['read', 'write'])] private string $filename = ''; /** @@ -64,46 +62,40 @@ class StoredObject implements Document, TrackCreationInterface * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "write"}) */ + #[Serializer\Groups(['read', 'write'])] private ?int $id = null; /** * @var int[] * * @ORM\Column(type="json", name="iv") - * - * @Serializer\Groups({"read", "write"}) */ + #[Serializer\Groups(['read', 'write'])] private array $iv = []; /** * @ORM\Column(type="json", name="key") - * - * @Serializer\Groups({"read", "write"}) */ + #[Serializer\Groups(['read', 'write'])] private array $keyInfos = []; /** * @ORM\Column(type="text", name="title") - * - * @Serializer\Groups({"read", "write"}) */ + #[Serializer\Groups(['read', 'write'])] private string $title = ''; /** * @ORM\Column(type="text", name="type", options={"default": ""}) - * - * @Serializer\Groups({"read", "write"}) */ + #[Serializer\Groups(['read', 'write'])] private string $type = ''; /** * @ORM\Column(type="uuid", unique=true) - * - * @Serializer\Groups({"read", "write"}) */ + #[Serializer\Groups(['read', 'write'])] private UuidInterface $uuid; /** @@ -135,10 +127,9 @@ class StoredObject implements Document, TrackCreationInterface * @param StoredObject::STATUS_* $status */ public function __construct(/** - * @ORM\Column(type="text", options={"default": "ready"}) - * - * @Serializer\Groups({"read"}) - */ + * @ORM\Column(type="text", options={"default": "ready"}) + */ + #[Serializer\Groups(['read'])] private string $status = 'ready' ) { $this->uuid = Uuid::uuid4(); @@ -152,10 +143,9 @@ class StoredObject implements Document, TrackCreationInterface } /** - * @Serializer\Groups({"read", "write"}) - * * @deprecated */ + #[Serializer\Groups(['read', 'write'])] public function getCreationDate(): \DateTime { if (null === $this->createdAt) { @@ -233,10 +223,9 @@ class StoredObject implements Document, TrackCreationInterface } /** - * @Serializer\Groups({"write"}) - * * @deprecated */ + #[Serializer\Groups(['write'])] public function setCreationDate(\DateTime $creationDate): self { $this->createdAt = \DateTimeImmutable::createFromMutable($creationDate); diff --git a/src/Bundle/ChillEventBundle/Controller/AdminController.php b/src/Bundle/ChillEventBundle/Controller/AdminController.php index 3434df9e5..5e8bd3023 100644 --- a/src/Bundle/ChillEventBundle/Controller/AdminController.php +++ b/src/Bundle/ChillEventBundle/Controller/AdminController.php @@ -22,9 +22,8 @@ class AdminController extends AbstractController { /** * Event admin. - * - * @Route("/{_locale}/admin/event", name="chill_event_admin_index") */ + #[Route(path: '/{_locale}/admin/event', name: 'chill_event_admin_index')] public function indexAdminAction() { return $this->render('@ChillEvent/Admin/index.html.twig'); diff --git a/src/Bundle/ChillEventBundle/Controller/EventController.php b/src/Bundle/ChillEventBundle/Controller/EventController.php index c652ddecf..72bc8964e 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventController.php @@ -60,9 +60,7 @@ final class EventController extends AbstractController private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry ) {} - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/delete", name="chill_event__event_delete", requirements={"event_id"="\d+"}, methods={"GET", "DELETE"}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/delete', name: 'chill_event__event_delete', requirements: ['event_id' => '\d+'], methods: ['GET', 'DELETE'])] public function deleteAction($event_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response { $em = $this->managerRegistry->getManager(); @@ -113,9 +111,11 @@ final class EventController extends AbstractController * Displays a form to edit an existing Event entity. * * @return \Symfony\Component\HttpFoundation\Response + * @return \Symfony\Component\HttpFoundation\Response * * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/edit", name="chill_event__event_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/edit', name: 'chill_event__event_edit')] public function editAction($event_id) { $em = $this->managerRegistry->getManager(); @@ -140,9 +140,11 @@ final class EventController extends AbstractController * @return \Symfony\Component\HttpFoundation\Response * * @throws \Doctrine\ORM\NonUniqueResultException + * @throws \Doctrine\ORM\NonUniqueResultException * * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{person_id}/list", name="chill_event__list_by_person", methods={"GET"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{person_id}/list', name: 'chill_event__list_by_person', methods: ['GET'])] public function listByPersonAction($person_id) { $em = $this->managerRegistry->getManager(); @@ -188,9 +190,7 @@ final class EventController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/most_recent", name="chill_event_list_most_recent", options={null}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/most_recent', name: 'chill_event_list_most_recent', options: [null])] public function mostRecentIndexAction() { return $this->redirectToRoute('chill_main_search', [ @@ -202,9 +202,11 @@ final class EventController extends AbstractController * Displays a form to create a new Event entity. * * @return \Symfony\Component\HttpFoundation\Response + * @return \Symfony\Component\HttpFoundation\Response * * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/new", name="chill_event__event_new", methods={"GET", "POST"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/new', name: 'chill_event__event_new', methods: ['GET', 'POST'])] public function newAction(?Center $center, Request $request) { $user = $this->security->getUser(); @@ -244,9 +246,8 @@ final class EventController extends AbstractController /** * First step of new Event form. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/new/pick-center", name="chill_event__event_new_pickcenter", options={null}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/new/pick-center', name: 'chill_event__event_new_pickcenter', options: [null])] public function newPickCenterAction() { $role = 'CHILL_EVENT_CREATE'; @@ -294,9 +295,11 @@ final class EventController extends AbstractController * @return \Symfony\Component\HttpFoundation\Response * * @throws \PhpOffice\PhpSpreadsheet\Exception + * @throws \PhpOffice\PhpSpreadsheet\Exception * * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/show", name="chill_event__event_show") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/show', name: 'chill_event__event_show')] public function showAction(Event $event, Request $request) { if (!$event) { @@ -326,9 +329,8 @@ final class EventController extends AbstractController /** * Edits an existing Event entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/update", name="chill_event__event_update", methods={"POST", "PUT"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/update', name: 'chill_event__event_update', methods: ['POST', 'PUT'])] public function updateAction(Request $request, $event_id): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillEventBundle/Controller/EventListController.php b/src/Bundle/ChillEventBundle/Controller/EventListController.php index 60df81240..692611adc 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventListController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventListController.php @@ -42,9 +42,7 @@ final readonly class EventListController private UrlGeneratorInterface $urlGenerator, ) {} - /** - * @Route("{_locale}/event/event/list", name="chill_event_event_list") - */ + #[Route(path: '{_locale}/event/event/list', name: 'chill_event_event_list')] public function __invoke(): Response { $filter = $this->buildFilterOrder(); diff --git a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php index 11cddbf77..881f7a135 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php @@ -26,9 +26,8 @@ class EventTypeController extends AbstractController /** * Creates a new EventType entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/create", name="chill_eventtype_admin_create", methods={"POST"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/create', name: 'chill_eventtype_admin_create', methods: ['POST'])] public function createAction(Request $request) { $entity = new EventType(); @@ -51,9 +50,8 @@ class EventTypeController extends AbstractController /** * Deletes a EventType entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/{id}/delete", name="chill_eventtype_admin_delete", methods={"POST", "DELETE"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/delete', name: 'chill_eventtype_admin_delete', methods: ['POST', 'DELETE'])] public function deleteAction(Request $request, mixed $id) { $form = $this->createDeleteForm($id); @@ -76,9 +74,8 @@ class EventTypeController extends AbstractController /** * Displays a form to edit an existing EventType entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/{id}/edit", name="chill_eventtype_admin_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/edit', name: 'chill_eventtype_admin_edit')] public function editAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -101,9 +98,8 @@ class EventTypeController extends AbstractController /** * Lists all EventType entities. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/", name="chill_eventtype_admin", options={null}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/', name: 'chill_eventtype_admin', options: [null])] public function indexAction() { $em = $this->managerRegistry->getManager(); @@ -117,9 +113,8 @@ class EventTypeController extends AbstractController /** * Displays a form to create a new EventType entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/new", name="chill_eventtype_admin_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/new', name: 'chill_eventtype_admin_new')] public function newAction() { $entity = new EventType(); @@ -133,9 +128,8 @@ class EventTypeController extends AbstractController /** * Finds and displays a EventType entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/{id}/show", name="chill_eventtype_admin_show") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/show', name: 'chill_eventtype_admin_show')] public function showAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -156,9 +150,8 @@ class EventTypeController extends AbstractController /** * Edits an existing EventType entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/{id}/update", name="chill_eventtype_admin_update", methods={"POST", "PUT"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/update', name: 'chill_eventtype_admin_update', methods: ['POST', 'PUT'])] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php index 5d911adf2..7b03f7685 100644 --- a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php +++ b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php @@ -44,9 +44,7 @@ final class ParticipationController extends AbstractController private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry ) {} - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/create", name="chill_event_participation_create") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/create', name: 'chill_event_participation_create')] public function createAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse { // test the request is correct @@ -243,9 +241,8 @@ final class ParticipationController extends AbstractController /** * @param int $participation_id - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{participation_id}/delete", name="chill_event_participation_delete", requirements={"participation_id"="\d+"}, methods={"GET", "DELETE"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{participation_id}/delete', name: 'chill_event_participation_delete', requirements: ['participation_id' => '\d+'], methods: ['GET', 'DELETE'])] public function deleteAction($participation_id, Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse { $em = $this->managerRegistry->getManager(); @@ -292,9 +289,11 @@ final class ParticipationController extends AbstractController * * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException if the participation is not found * @throws \Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException if the user is not allowed to edit the participation + * @throws \Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException if the user is not allowed to edit the participation * * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{participation_id}/edit", name="chill_event_participation_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{participation_id}/edit', name: 'chill_event_participation_edit')] public function editAction(int $participation_id): Response { /** @var Participation $participation */ @@ -324,9 +323,11 @@ final class ParticipationController extends AbstractController * show a form to edit multiple participation for the same event. * * @param int $event_id + * @param int $event_id * * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{event_id}/edit_multiple", name="chill_event_participation_edit_multiple") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{event_id}/edit_multiple', name: 'chill_event_participation_edit_multiple')] public function editMultipleAction($event_id): Response|\Symfony\Component\HttpFoundation\RedirectResponse { $event = $this->managerRegistry->getRepository(Event::class) @@ -381,9 +382,8 @@ final class ParticipationController extends AbstractController * This function parse the person_id / persons_ids query argument * and decide if it should process a single or multiple participation. Depending * on this, the appropriate layout and form. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/new", name="chill_event_participation_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/new', name: 'chill_event_participation_new')] public function newAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse { // test the request is correct @@ -416,9 +416,7 @@ final class ParticipationController extends AbstractController ."'persons_ids' argument in query"); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{participation_id}/update", name="chill_event_participation_update", methods={"POST"}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{participation_id}/update', name: 'chill_event_participation_update', methods: ['POST'])] public function updateAction(int $participation_id, Request $request): Response { /** @var Participation $participation */ @@ -460,9 +458,7 @@ final class ParticipationController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{event_id}/update_multiple", name="chill_event_participation_update_multiple", methods={"POST"}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{event_id}/update_multiple', name: 'chill_event_participation_update_multiple', methods: ['POST'])] public function updateMultipleAction(mixed $event_id, Request $request) { /** @var Event $event */ diff --git a/src/Bundle/ChillEventBundle/Controller/RoleController.php b/src/Bundle/ChillEventBundle/Controller/RoleController.php index 7d3e6e0f1..e1d94389a 100644 --- a/src/Bundle/ChillEventBundle/Controller/RoleController.php +++ b/src/Bundle/ChillEventBundle/Controller/RoleController.php @@ -26,9 +26,8 @@ class RoleController extends AbstractController /** * Creates a new Role entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/create", name="chill_event_admin_role_create", methods={"POST"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/create', name: 'chill_event_admin_role_create', methods: ['POST'])] public function createAction(Request $request) { $entity = new Role(); @@ -51,9 +50,8 @@ class RoleController extends AbstractController /** * Deletes a Role entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/{id}/delete", name="chill_event_admin_role_delete", methods={"POST", "DELETE"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/delete', name: 'chill_event_admin_role_delete', methods: ['POST', 'DELETE'])] public function deleteAction(Request $request, mixed $id) { $form = $this->createDeleteForm($id); @@ -76,9 +74,8 @@ class RoleController extends AbstractController /** * Displays a form to edit an existing Role entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/{id}/edit", name="chill_event_admin_role_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/edit', name: 'chill_event_admin_role_edit')] public function editAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -101,9 +98,8 @@ class RoleController extends AbstractController /** * Lists all Role entities. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/", name="chill_event_admin_role", options={null}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/', name: 'chill_event_admin_role', options: [null])] public function indexAction() { $em = $this->managerRegistry->getManager(); @@ -117,9 +113,8 @@ class RoleController extends AbstractController /** * Displays a form to create a new Role entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/new", name="chill_event_admin_role_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/new', name: 'chill_event_admin_role_new')] public function newAction() { $entity = new Role(); @@ -133,9 +128,8 @@ class RoleController extends AbstractController /** * Finds and displays a Role entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/{id}/show", name="chill_event_admin_role_show") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/show', name: 'chill_event_admin_role_show')] public function showAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -156,9 +150,8 @@ class RoleController extends AbstractController /** * Edits an existing Role entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/{id}/update", name="chill_event_admin_role_update", methods={"POST", "PUT"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/update', name: 'chill_event_admin_role_update', methods: ['POST', 'PUT'])] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillEventBundle/Controller/StatusController.php b/src/Bundle/ChillEventBundle/Controller/StatusController.php index 294ca0222..77f6d4279 100644 --- a/src/Bundle/ChillEventBundle/Controller/StatusController.php +++ b/src/Bundle/ChillEventBundle/Controller/StatusController.php @@ -26,9 +26,8 @@ class StatusController extends AbstractController /** * Creates a new Status entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/create", name="chill_event_admin_status_create", methods={"POST"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/create', name: 'chill_event_admin_status_create', methods: ['POST'])] public function createAction(Request $request) { $entity = new Status(); @@ -51,9 +50,8 @@ class StatusController extends AbstractController /** * Deletes a Status entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/{id}/delete", name="chill_event_admin_status_delete", methods={"POST", "DELETE"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/delete', name: 'chill_event_admin_status_delete', methods: ['POST', 'DELETE'])] public function deleteAction(Request $request, mixed $id) { $form = $this->createDeleteForm($id); @@ -76,9 +74,8 @@ class StatusController extends AbstractController /** * Displays a form to edit an existing Status entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/{id}/edit", name="chill_event_admin_status_edit") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/edit', name: 'chill_event_admin_status_edit')] public function editAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -101,9 +98,8 @@ class StatusController extends AbstractController /** * Lists all Status entities. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/", name="chill_event_admin_status", options={null}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/', name: 'chill_event_admin_status', options: [null])] public function indexAction() { $em = $this->managerRegistry->getManager(); @@ -117,9 +113,8 @@ class StatusController extends AbstractController /** * Displays a form to create a new Status entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/new", name="chill_event_admin_status_new") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/new', name: 'chill_event_admin_status_new')] public function newAction() { $entity = new Status(); @@ -133,9 +128,8 @@ class StatusController extends AbstractController /** * Finds and displays a Status entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/{id}/show", name="chill_event_admin_status_show") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/show', name: 'chill_event_admin_status_show')] public function showAction(mixed $id) { $em = $this->managerRegistry->getManager(); @@ -156,9 +150,8 @@ class StatusController extends AbstractController /** * Edits an existing Status entity. - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/{id}/update", name="chill_event_admin_status_update", methods={"POST", "PUT"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/update', name: 'chill_event_admin_status_update', methods: ['POST', 'PUT'])] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillEventBundle/Entity/Event.php b/src/Bundle/ChillEventBundle/Entity/Event.php index 486a67c5c..88d4ca3eb 100644 --- a/src/Bundle/ChillEventBundle/Entity/Event.php +++ b/src/Bundle/ChillEventBundle/Entity/Event.php @@ -45,9 +45,8 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")A - * - * @Assert\NotNull() */ + #[Assert\NotNull] private ?Center $center = null; /** @@ -76,9 +75,8 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter /** * @ORM\Column(type="string", length=150) - * - * @Assert\NotBlank() */ + #[Assert\NotBlank] private ?string $name = null; /** @@ -92,9 +90,8 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter /** * @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\EventType") - * - * @Assert\NotNull() */ + #[Assert\NotNull] private ?EventType $type = null; /** diff --git a/src/Bundle/ChillEventBundle/Entity/Participation.php b/src/Bundle/ChillEventBundle/Entity/Participation.php index 9b4664f0d..55751998d 100644 --- a/src/Bundle/ChillEventBundle/Entity/Participation.php +++ b/src/Bundle/ChillEventBundle/Entity/Participation.php @@ -34,11 +34,12 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * * @ORM\UniqueConstraint(name="chill_event_participation_event_person_unique_idx", columns={"event_id", "person_id"}) * }) + * @ORM\UniqueConstraint(name="chill_event_participation_event_person_unique_idx", columns={"event_id", "person_id"}) + * }) * * @ORM\HasLifecycleCallbacks - * - * @UniqueEntity({"event", "person"}, message="event.validation.person_already_participate_to_event") */ +#[UniqueEntity(['event', 'person'], message: 'event.validation.person_already_participate_to_event')] class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterface, TrackUpdateInterface, TrackCreationInterface { use TrackCreationTrait; @@ -62,9 +63,8 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa /** * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person") - * - * @Assert\NotNull() */ + #[Assert\NotNull] private ?Person $person = null; /** @@ -74,9 +74,8 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa /** * @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\Status") - * - * @Assert\NotNull() */ + #[Assert\NotNull] private ?Status $status = null; public function getCenter() diff --git a/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php b/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php index 0d6dd0998..c7871a346 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 da14d85ff..3e1367a00 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 ec38fa173..6d998f732 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 710dedb8f..d5dedd169 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/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 b22027499..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) 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 23aa9fd10..3961c9f3a 100644 --- a/src/Bundle/ChillMainBundle/Controller/AbsenceController.php +++ b/src/Bundle/ChillMainBundle/Controller/AbsenceController.php @@ -21,13 +21,7 @@ class AbsenceController extends AbstractController { public function __construct(private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} - /** - * @Route( - * "/{_locale}/absence", - * name="chill_main_user_absence_index", - * methods={"GET", "POST"} - * ) - */ + #[Route(path: '/{_locale}/absence', name: 'chill_main_user_absence_index', methods: ['GET', 'POST'])] public function setAbsence(Request $request) { $user = $this->security->getUser(); @@ -48,13 +42,7 @@ 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->security->getUser(); diff --git a/src/Bundle/ChillMainBundle/Controller/AddressApiController.php b/src/Bundle/ChillMainBundle/Controller/AddressApiController.php index 1f7abdb7a..5ea68cdbc 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressApiController.php @@ -24,10 +24,8 @@ class AddressApiController extends ApiController /** * 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'); diff --git a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php index b3cf68849..e50cea6bb 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php @@ -28,9 +28,7 @@ final class AddressReferenceAPIController extends ApiController { 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 967ee7b5b..680a63859 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php @@ -25,9 +25,7 @@ class AddressToReferenceMatcherController { 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')) { @@ -48,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')) { @@ -73,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/DashboardApiController.php b/src/Bundle/ChillMainBundle/Controller/DashboardApiController.php index c9b5435ce..ffc23da81 100644 --- a/src/Bundle/ChillMainBundle/Controller/DashboardApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/DashboardApiController.php @@ -24,9 +24,8 @@ final readonly class DashboardApiController /** * Get user dashboard config (not yet based on user id and still hardcoded for now). - * - * @Route("/api/1.0/main/dashboard-config-item.json", methods={"get"}) */ + #[Route(path: '/api/1.0/main/dashboard-config-item.json', methods: ['get'])] public function getDashboardConfiguration(): JsonResponse { $data = []; diff --git a/src/Bundle/ChillMainBundle/Controller/DefaultController.php b/src/Bundle/ChillMainBundle/Controller/DefaultController.php index 389c89767..389ed7764 100644 --- a/src/Bundle/ChillMainBundle/Controller/DefaultController.php +++ b/src/Bundle/ChillMainBundle/Controller/DefaultController.php @@ -18,9 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; */ class DefaultController extends AbstractController { - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/homepage", name="chill_main_homepage") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/homepage', name: 'chill_main_homepage')] public function indexAction() { if ($this->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..709d3ceb9 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 */ @@ -109,9 +107,11 @@ class ExportController extends AbstractController * @param string $alias * * @return Response + * @return Response * * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/generate/{alias}", name="chill_main_export_generate", methods={"GET"}) */ + #[Route(path: '/{_locale}/exports/generate/{alias}', name: 'chill_main_export_generate', methods: ['GET'])] public function generateAction(Request $request, $alias) { /** @var ExportManager $exportManager */ @@ -130,10 +130,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 +153,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 +177,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 +202,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 +222,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'); diff --git a/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php b/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php index 24253de36..7574eea1e 100644 --- a/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/GeographicalUnitByAddressApiController.php @@ -26,9 +26,7 @@ class GeographicalUnitByAddressApiController { public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly Security $security, private readonly SerializerInterface $serializer) {} - /** - * @Route("/api/1.0/main/geographical-unit/by-address/{id}.{_format}", requirements={"_format": "json"}) - */ + #[Route(path: '/api/1.0/main/geographical-unit/by-address/{id}.{_format}', requirements: ['_format' => 'json'])] public function getGeographicalUnitCoveringAddress(Address $address): JsonResponse { if (!$this->security->isGranted('ROLE_USER')) { diff --git a/src/Bundle/ChillMainBundle/Controller/LoginController.php b/src/Bundle/ChillMainBundle/Controller/LoginController.php index df295d0b2..a23d9ff08 100644 --- a/src/Bundle/ChillMainBundle/Controller/LoginController.php +++ b/src/Bundle/ChillMainBundle/Controller/LoginController.php @@ -35,9 +35,11 @@ class LoginController extends AbstractController * Show a login form. * * @return Response + * @return Response * * @\Symfony\Component\Routing\Annotation\Route(path="/login", name="login") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/login', name: 'login')] public function loginAction(Request $request) { return $this->render('@ChillMain/Login/login.html.twig', [ diff --git a/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php b/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php index c4476a041..c687acc2f 100644 --- a/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php @@ -29,9 +29,8 @@ class NewsItemApiController /** * 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 b79812464..78b7077ee 100644 --- a/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php +++ b/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php @@ -30,9 +30,7 @@ final readonly class NewsItemHistoryController 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(); @@ -48,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 16599b9a2..2fb7969cf 100644 --- a/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/NotificationApiController.php @@ -26,32 +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) {} - /** - * @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 ea79317bf..162c099ef 100644 --- a/src/Bundle/ChillMainBundle/Controller/NotificationController.php +++ b/src/Bundle/ChillMainBundle/Controller/NotificationController.php @@ -35,16 +35,12 @@ use Symfony\Component\Routing\Annotation\Route; 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 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'); @@ -102,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); @@ -132,9 +126,7 @@ 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'); @@ -174,9 +166,7 @@ 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'); @@ -200,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'); @@ -226,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); diff --git a/src/Bundle/ChillMainBundle/Controller/PasswordController.php b/src/Bundle/ChillMainBundle/Controller/PasswordController.php index e65c70672..efd6c9630 100644 --- a/src/Bundle/ChillMainBundle/Controller/PasswordController.php +++ b/src/Bundle/ChillMainBundle/Controller/PasswordController.php @@ -27,7 +27,6 @@ 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; @@ -40,21 +39,18 @@ final class PasswordController extends AbstractController /** * PasswordController constructor. */ - public function __construct(private readonly LoggerInterface $chillLogger, private readonly UserPasswordEncoderInterface $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) {} + 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)) { @@ -96,7 +92,7 @@ final 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 @@ -120,9 +116,11 @@ final class PasswordController extends AbstractController /** * @throws \Doctrine\ORM\NoResultException * @throws \Doctrine\ORM\NonUniqueResultException + * @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)) { @@ -193,9 +191,8 @@ final 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'); @@ -203,9 +200,8 @@ final 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')) { @@ -234,7 +230,7 @@ final class PasswordController extends AbstractController ] ); - $user->setPassword($this->passwordEncoder->encodePassword($user, $password)); + $user->setPassword($this->passwordEncoder->hashPassword($user, $password)); $em = $this->managerRegistry->getManager(); $em->flush(); diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php b/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php index 8b0561635..2abb7333f 100644 --- a/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php @@ -24,10 +24,9 @@ class PermissionApiController extends AbstractController 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 52ef9bfbb..62cc7a724 100644 --- a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php +++ b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php @@ -49,9 +49,7 @@ final class PermissionsGroupController extends AbstractController 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: ['PUT'])] public function addLinkRoleScopeAction(Request $request, int $id): Response { $permissionsGroup = $this->permissionsGroupRepository->find($id); @@ -129,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(); @@ -153,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: ['DELETE'])] public function deleteLinkRoleScopeAction(int $pgid, int $rsid): Response { $permissionsGroup = $this->permissionsGroupRepository->find($pgid); @@ -211,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); @@ -259,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(); @@ -273,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(); @@ -289,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); @@ -342,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 diff --git a/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php index 2b897130d..cd13ad455 100644 --- a/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php +++ b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php @@ -28,9 +28,7 @@ final class PostalCodeAPIController extends ApiController { 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 b7ea48328..edd8efda8 100644 --- a/src/Bundle/ChillMainBundle/Controller/PostalCodeController.php +++ b/src/Bundle/ChillMainBundle/Controller/PostalCodeController.php @@ -35,12 +35,9 @@ class PostalCodeController extends AbstractController } /** - * @Route( - * "{_locale}/postalcode/search" - * ) - * * @return JsonResponse */ + #[Route(path: '{_locale}/postalcode/search')] public function searchAction(Request $request) { $pattern = $request->query->getAlnum('q', ''); diff --git a/src/Bundle/ChillMainBundle/Controller/SavedExportController.php b/src/Bundle/ChillMainBundle/Controller/SavedExportController.php index 15bfcb9bb..82d41a9e1 100644 --- a/src/Bundle/ChillMainBundle/Controller/SavedExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/SavedExportController.php @@ -36,9 +36,7 @@ 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) {} - /** - * @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)) { @@ -71,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)) { @@ -104,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 e6bcdce86..5e932063a 100644 --- a/src/Bundle/ChillMainBundle/Controller/ScopeController.php +++ b/src/Bundle/ChillMainBundle/Controller/ScopeController.php @@ -32,9 +32,8 @@ class ScopeController extends AbstractController /** * 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(); @@ -57,9 +56,8 @@ 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") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/{id}/edit', name: 'admin_scope_edit')] public function editAction(Scope $scope, Request $request): Response { $editForm = $this->createEditForm($scope); @@ -79,9 +77,8 @@ 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->managerRegistry->getManager(); @@ -95,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(); diff --git a/src/Bundle/ChillMainBundle/Controller/SearchController.php b/src/Bundle/ChillMainBundle/Controller/SearchController.php index 78dd5eaba..90fa6e1b5 100644 --- a/src/Bundle/ChillMainBundle/Controller/SearchController.php +++ b/src/Bundle/ChillMainBundle/Controller/SearchController.php @@ -34,9 +34,7 @@ class SearchController extends AbstractController { 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 { @@ -81,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 */ @@ -100,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', '')); @@ -192,9 +186,7 @@ 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 diff --git a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php index ebbd7a360..97507739e 100644 --- a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php +++ b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php @@ -22,12 +22,7 @@ class TimelineCenterController extends AbstractController { 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 ae764c9d2..262bfdfde 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserApiController.php @@ -24,15 +24,7 @@ class UserApiController extends ApiController { public function __construct(private readonly ChillSecurity $security) {} - /** - * @Route( - * "/api/1.0/main/user-current-location.{_format}", - * name="chill_main_user_current_location", - * requirements={ - * "_format": "json" - * } - * ) - */ + #[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')) { @@ -47,15 +39,7 @@ class UserApiController extends ApiController ); } - /** - * @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 81f39b084..cc1666494 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserController.php @@ -31,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; @@ -42,7 +41,7 @@ class UserController extends CRUDController public function __construct( private readonly LoggerInterface $logger, private readonly ValidatorInterface $validator, - private readonly UserPasswordEncoderInterface $passwordEncoder, + private readonly \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder, private readonly UserRepository $userRepository, protected ParameterBagInterface $parameterBag, private readonly TranslatorInterface $translator, @@ -50,10 +49,7 @@ class UserController extends CRUDController 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->managerRegistry->getManager(); @@ -102,10 +98,7 @@ 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->managerRegistry->getManager(); @@ -202,9 +195,8 @@ 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->security->getUser(); @@ -234,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); @@ -251,7 +242,7 @@ class UserController extends CRUDController 'user' => $user->getUsername(), ]); - $user->setPassword($this->passwordEncoder->encodePassword($user, $password)); + $user->setPassword($this->passwordEncoder->hashPassword($user, $password)); $this->managerRegistry->getManager()->flush(); $this->addFlash('success', $this->translator->trans('Password successfully updated!')); @@ -360,7 +351,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 diff --git a/src/Bundle/ChillMainBundle/Controller/UserExportController.php b/src/Bundle/ChillMainBundle/Controller/UserExportController.php index 7f14b5e64..64b89a6f5 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserExportController.php @@ -33,9 +33,8 @@ final readonly class UserExportController * @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')) { @@ -94,9 +93,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 55d7aceb7..1bbf5c0c1 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php @@ -23,9 +23,7 @@ class UserJobScopeHistoriesController extends AbstractController 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 ecdde78a5..a48d1a1e2 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserProfileController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserProfileController.php @@ -32,9 +32,8 @@ final class UserProfileController extends AbstractController /** * 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) { if (!$this->security->isGranted('ROLE_USER')) { diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php index 4c4d8218c..28dca8016 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowApiController.php @@ -33,9 +33,8 @@ class WorkflowApiController /** * 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) { @@ -72,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) { @@ -109,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 b19f03c3b..d75e42012 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php @@ -40,9 +40,7 @@ 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 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')) { @@ -86,9 +84,7 @@ class WorkflowController extends AbstractController 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); @@ -113,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)) { @@ -143,9 +137,8 @@ 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'); @@ -173,9 +166,8 @@ 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'); @@ -201,9 +193,7 @@ 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'); @@ -228,9 +218,7 @@ 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'); @@ -255,9 +243,7 @@ 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'); @@ -282,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/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/Doctrine/Model/TrackCreationTrait.php b/src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationTrait.php index 29f1c2f43..71c8dc504 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationTrait.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationTrait.php @@ -20,18 +20,16 @@ trait TrackCreationTrait { /** * @ORM\Column(type="datetime_immutable", nullable=true, options={"default": NULL}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?\DateTimeImmutable $createdAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] 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..c48a287d6 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Model/TrackUpdateTrait.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Model/TrackUpdateTrait.php @@ -20,18 +20,16 @@ trait TrackUpdateTrait { /** * @ORM\Column(type="datetime_immutable", nullable=true, options={"default": NULL}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?\DateTimeImmutable $updatedAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] 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..b98f27b1a 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -57,60 +57,52 @@ class Address implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\ManyToOne(targetEntity=AddressReference::class) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private ?AddressReference $addressReference = null; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $buildingName = ''; /** * @ORM\Column(type="boolean", options={"default": false}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private bool $confidential = false; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $corridor = ''; /** * used for the CEDEX information. * * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $distribution = ''; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $extra = ''; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $flat = ''; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $floor = ''; /** @@ -140,19 +132,17 @@ class Address implements TrackCreationInterface, TrackUpdateInterface * * @ORM\GeneratedValue(strategy="AUTO") * - * @Groups({"write"}) - * * @readonly */ + #[Groups(['write'])] 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'])] private bool $isNoAddress = false; /** @@ -160,28 +150,25 @@ class Address implements TrackCreationInterface, TrackUpdateInterface * * @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty") * - * @Groups({"write"}) - * * @ORM\JoinColumn(nullable=true, onDelete="SET NULL") */ + #[Groups(['write'])] private ?ThirdParty $linkedToThirdParty = null; /** * A geospatial field storing the coordinates of the Address. * * @ORM\Column(type="point", nullable=true) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private ?Point $point = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode") * * @ORM\JoinColumn(nullable=false) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private ?PostalCode $postcode = null; /** @@ -198,23 +185,20 @@ class Address implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $steps = ''; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $street = ''; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $streetNumber = ''; /** @@ -222,9 +206,8 @@ class Address implements TrackCreationInterface, TrackUpdateInterface * of address. By default, the current date. * * @ORM\Column(type="date") - * - * @Groups({"write"}) */ + #[Groups(['write'])] private \DateTime $validFrom; /** @@ -232,9 +215,8 @@ class Address implements TrackCreationInterface, TrackUpdateInterface * of address. * * @ORM\Column(type="date", nullable=true) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private ?\DateTime $validTo = null; public function __construct() diff --git a/src/Bundle/ChillMainBundle/Entity/AddressReference.php b/src/Bundle/ChillMainBundle/Entity/AddressReference.php index 49b510f8c..84c8aa2b6 100644 --- a/src/Bundle/ChillMainBundle/Entity/AddressReference.php +++ b/src/Bundle/ChillMainBundle/Entity/AddressReference.php @@ -42,16 +42,14 @@ class AddressReference /** * @ORM\Column(type="datetime_immutable", nullable=true) - * - * @groups({"read"}) */ + #[Groups(['read'])] private ?\DateTimeImmutable $createdAt = null; /** * @ORM\Column(type="datetime_immutable", nullable=true) - * - * @groups({"read"}) */ + #[Groups(['read'])] private ?\DateTimeImmutable $deletedAt = null; /** @@ -60,67 +58,58 @@ class AddressReference * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @groups({"read"}) */ + #[Groups(['read'])] private ?int $id = null; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @groups({"read"}) */ + #[Groups(['read'])] private string $municipalityCode = ''; /** * A geospatial field storing the coordinates of the Address. * * @ORM\Column(type="point") - * - * @groups({"read"}) */ + #[Groups(['read'])] private ?Point $point = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode") - * - * @groups({"read"}) */ + #[Groups(['read'])] private ?PostalCode $postcode = null; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @groups({"read"}) */ + #[Groups(['read'])] private string $refId = ''; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @groups({"read"}) */ + #[Groups(['read'])] private string $source = ''; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @groups({"read"}) */ + #[Groups(['read'])] private string $street = ''; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @groups({"read"}) */ + #[Groups(['read'])] private string $streetNumber = ''; /** * @ORM\Column(type="datetime_immutable", nullable=true) - * - * @groups({"read"}) */ + #[Groups(['read'])] 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..20c8e3767 100644 --- a/src/Bundle/ChillMainBundle/Entity/Center.php +++ b/src/Bundle/ChillMainBundle/Entity/Center.php @@ -39,16 +39,14 @@ class Center implements HasCenterInterface, \Stringable * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="string", length=255) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private string $name = ''; /** diff --git a/src/Bundle/ChillMainBundle/Entity/Civility.php b/src/Bundle/ChillMainBundle/Entity/Civility.php index 322155fe5..fa1accae8 100644 --- a/src/Bundle/ChillMainBundle/Entity/Civility.php +++ b/src/Bundle/ChillMainBundle/Entity/Civility.php @@ -18,25 +18,22 @@ 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])] class Civility { /** * @ORM\Column(type="json") * - * @Serializer\Groups({"read", "docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private array $abbreviation = []; /** * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $active = true; /** @@ -45,18 +42,16 @@ class Civility * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] 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'])] private array $name = []; /** diff --git a/src/Bundle/ChillMainBundle/Entity/Country.php b/src/Bundle/ChillMainBundle/Entity/Country.php index 91484ba46..7ed4dc576 100644 --- a/src/Bundle/ChillMainBundle/Entity/Country.php +++ b/src/Bundle/ChillMainBundle/Entity/Country.php @@ -31,10 +31,9 @@ class Country /** * @ORM\Column(type="string", length=3) * - * @groups({"read", "docgen:read"}) - * * @Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private string $countryCode = ''; /** @@ -43,9 +42,8 @@ class Country * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?int $id = null; /** @@ -53,10 +51,9 @@ class Country * * @ORM\Column(type="json") * - * @groups({"read", "docgen:read"}) - * * @Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private array $name = []; public function getCountryCode(): string diff --git a/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php b/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php index ed9cc07bf..03662b5ff 100644 --- a/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php +++ b/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php @@ -28,27 +28,22 @@ class DashboardConfigItem * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"dashboardConfigItem:read", "read"}) */ + #[Serializer\Groups(['dashboardConfigItem:read', 'read'])] private ?int $id = null; /** * @ORM\Column(type="string") - * - * @Serializer\Groups({"dashboardConfigItem:read", "read"}) - * - * @Assert\NotNull */ + #[Serializer\Groups(['dashboardConfigItem:read', 'read'])] + #[Assert\NotNull] private string $type = ''; /** * @ORM\Column(type="string") - * - * @Serializer\Groups({"dashboardConfigItem:read", "read"}) - * - * @Assert\NotNull */ + #[Serializer\Groups(['dashboardConfigItem:read', 'read'])] + #[Assert\NotNull] private string $position = ''; /** @@ -58,9 +53,8 @@ class DashboardConfigItem /** * @ORM\Column(type="json", options={"default": "[]", "jsonb": true}) - * - * @Serializer\Groups({"dashboardConfigItem:read"}) */ + #[Serializer\Groups(['dashboardConfigItem:read'])] private array $metadata = []; public function getId(): ?int diff --git a/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php b/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php index 79e28e6f3..196b5140a 100644 --- a/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php +++ b/src/Bundle/ChillMainBundle/Entity/GeographicalUnit/SimpleGeographicalUnitDTO.php @@ -25,33 +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..7129de879 100644 --- a/src/Bundle/ChillMainBundle/Entity/GeographicalUnitLayer.php +++ b/src/Bundle/ChillMainBundle/Entity/GeographicalUnitLayer.php @@ -32,23 +32,20 @@ class GeographicalUnitLayer * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?int $id = null; /** * @ORM\Column(type="json", nullable=false, options={"default": "[]"}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private array $name = []; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private string $refId = ''; /** diff --git a/src/Bundle/ChillMainBundle/Entity/Language.php b/src/Bundle/ChillMainBundle/Entity/Language.php index 1a91de7b8..b6e42d7d8 100644 --- a/src/Bundle/ChillMainBundle/Entity/Language.php +++ b/src/Bundle/ChillMainBundle/Entity/Language.php @@ -31,9 +31,8 @@ class Language * @ORM\Id * * @ORM\Column(type="string") - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?string $id = null; /** @@ -41,10 +40,9 @@ class Language * * @ORM\Column(type="json") * - * @Serializer\Groups({"docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private array $name = []; /** diff --git a/src/Bundle/ChillMainBundle/Entity/Location.php b/src/Bundle/ChillMainBundle/Entity/Location.php index 29a049d35..92a2b43b7 100644 --- a/src/Bundle/ChillMainBundle/Entity/Location.php +++ b/src/Bundle/ChillMainBundle/Entity/Location.php @@ -24,55 +24,46 @@ 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])] class Location implements TrackCreationInterface, TrackUpdateInterface { /** * @ORM\Column(type="boolean", nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] 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'])] private ?Address $address = null; /** * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $availableForUsers = false; /** * @ORM\Column(type="datetime_immutable", nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?\DateTimeImmutable $createdAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?User $createdBy = null; /** * @ORM\Column(type="string", length=255, nullable=true) - * - * @Serializer\Groups({"read", "write", "docgen:read"}) */ + #[Serializer\Groups(['read', 'write', 'docgen:read'])] private ?string $email = null; /** @@ -81,57 +72,50 @@ class Location implements TrackCreationInterface, TrackUpdateInterface * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] 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'])] private ?LocationType $locationType = null; /** * @ORM\Column(type="string", length=255, nullable=true) - * - * @Serializer\Groups({"read", "write", "docgen:read"}) */ + #[Serializer\Groups(['read', 'write', 'docgen:read'])] 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'])] 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'])] private ?PhoneNumber $phonenumber2 = null; /** * @ORM\Column(type="datetime_immutable", nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?\DateTimeImmutable $updatedAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] 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..54e876d2d 100644 --- a/src/Bundle/ChillMainBundle/Entity/LocationType.php +++ b/src/Bundle/ChillMainBundle/Entity/LocationType.php @@ -21,13 +21,9 @@ 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'])] class LocationType { final public const DEFAULT_FOR_3PARTY = 'thirdparty'; @@ -42,44 +38,38 @@ class LocationType /** * @ORM\Column(type="boolean", nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $active = true; /** * @ORM\Column(type="string", length=32, options={"default": "optional"}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private string $addressRequired = self::STATUS_OPTIONAL; /** * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $availableForUsers = true; /** * @ORM\Column(type="string", length=32, options={"default": "optional"}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private string $contactData = self::STATUS_OPTIONAL; /** * @ORM\Column(type="string", nullable=true, length=32, unique=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?string $defaultFor = null; /** * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $editableByUsers = true; /** @@ -88,18 +78,16 @@ class LocationType * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] 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'])] 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..1aa2d83a1 100644 --- a/src/Bundle/ChillMainBundle/Entity/NewsItem.php +++ b/src/Bundle/ChillMainBundle/Entity/NewsItem.php @@ -36,49 +36,38 @@ class NewsItem implements TrackCreationInterface, TrackUpdateInterface * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?int $id = null; /** * @ORM\Column(type="text") - * - * @Groups({"read"}) - * - * @Assert\NotBlank - * - * @Assert\NotNull */ + #[Groups(['read'])] + #[Assert\NotBlank] + #[Assert\NotNull] private string $title = ''; /** * @ORM\Column(type="text") - * - * @Groups({"read"}) - * - * @Assert\NotBlank - * - * @Assert\NotNull */ + #[Groups(['read'])] + #[Assert\NotBlank] + #[Assert\NotNull] private string $content = ''; /** * @ORM\Column(type="date_immutable", nullable=false) - * - * @Assert\NotNull - * - * @Groups({"read"}) */ + #[Assert\NotNull] + #[Groups(['read'])] 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'])] 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..52dd6aba1 100644 --- a/src/Bundle/ChillMainBundle/Entity/Notification.php +++ b/src/Bundle/ChillMainBundle/Entity/Notification.php @@ -116,9 +116,8 @@ class Notification implements TrackUpdateInterface /** * @ORM\Column(type="text", options={"default": ""}) - * - * @Assert\NotBlank(message="notification.Title must be defined") */ + #[Assert\NotBlank(message: 'notification.Title must be defined')] private string $title = ''; /** @@ -187,10 +186,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()))) { diff --git a/src/Bundle/ChillMainBundle/Entity/NotificationComment.php b/src/Bundle/ChillMainBundle/Entity/NotificationComment.php index 49d1e859d..3e23a7ceb 100644 --- a/src/Bundle/ChillMainBundle/Entity/NotificationComment.php +++ b/src/Bundle/ChillMainBundle/Entity/NotificationComment.php @@ -29,9 +29,8 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac { /** * @ORM\Column(type="text") - * - * @Assert\NotBlank(message="notification.Comment content might not be blank") */ + #[Assert\NotBlank(message: 'notification.Comment content might not be blank')] private string $content = ''; /** diff --git a/src/Bundle/ChillMainBundle/Entity/PostalCode.php b/src/Bundle/ChillMainBundle/Entity/PostalCode.php index 4d906d6c8..fee552c6b 100644 --- a/src/Bundle/ChillMainBundle/Entity/PostalCode.php +++ b/src/Bundle/ChillMainBundle/Entity/PostalCode.php @@ -56,23 +56,20 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface /** * @ORM\Column(type="point", nullable=true) - * - * @groups({"read"}) */ + #[Groups(['read'])] private ?Point $center = null; /** * @ORM\Column(type="string", length=100) - * - * @groups({"write", "read"}) */ + #[Groups(['write', 'read'])] private ?string $code = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Country") - * - * @groups({"write", "read"}) */ + #[Groups(['write', 'read'])] private ?Country $country = null; /** @@ -86,37 +83,32 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @groups({"write", "read"}) */ + #[Groups(['write', 'read'])] private ?int $id = null; /** * @ORM\Column(type="string", length=255, name="label") - * - * @groups({"write", "read"}) */ + #[Groups(['write', 'read'])] private ?string $name = null; /** * @ORM\Column(name="origin", type="integer", nullable=true) - * - * @groups({"write", "read"}) */ + #[Groups(['write', 'read'])] private int $origin = 0; /** * @ORM\Column(type="string", length=255, nullable=true) - * - * @groups({"read"}) */ + #[Groups(['read'])] private ?string $postalCodeSource = null; /** * @ORM\Column(type="string", length=255, nullable=true) - * - * @groups({"read"}) */ + #[Groups(['read'])] private ?string $refPostalCodeId = null; public function getCenter(): ?Point diff --git a/src/Bundle/ChillMainBundle/Entity/SavedExport.php b/src/Bundle/ChillMainBundle/Entity/SavedExport.php index 224423783..b9b27c39b 100644 --- a/src/Bundle/ChillMainBundle/Entity/SavedExport.php +++ b/src/Bundle/ChillMainBundle/Entity/SavedExport.php @@ -33,9 +33,8 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Assert\NotBlank */ + #[Assert\NotBlank] private string $description = ''; /** @@ -59,9 +58,8 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Assert\NotBlank */ + #[Assert\NotBlank] private string $title = ''; /** diff --git a/src/Bundle/ChillMainBundle/Entity/Scope.php b/src/Bundle/ChillMainBundle/Entity/Scope.php index 464d60488..4a21c66d7 100644 --- a/src/Bundle/ChillMainBundle/Entity/Scope.php +++ b/src/Bundle/ChillMainBundle/Entity/Scope.php @@ -24,11 +24,8 @@ use Symfony\Component\Serializer\Annotation\Groups; * @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])] class Scope { /** @@ -42,9 +39,8 @@ class Scope * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?int $id = null; /** @@ -52,10 +48,9 @@ class Scope * * @ORM\Column(type="json") * - * @Groups({"read", "docgen:read"}) - * * @Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private array $name = []; /** diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index 4ea96bb2d..b9af72fd0 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -33,11 +33,8 @@ use Chill\MainBundle\Validation\Constraint\PhonenumberConstraint; * @ORM\Table(name="users") * * @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region") - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "user": User::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['user' => User::class])] class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInterface { /** diff --git a/src/Bundle/ChillMainBundle/Entity/UserJob.php b/src/Bundle/ChillMainBundle/Entity/UserJob.php index 6be1a5efe..d071d2adc 100644 --- a/src/Bundle/ChillMainBundle/Entity/UserJob.php +++ b/src/Bundle/ChillMainBundle/Entity/UserJob.php @@ -18,11 +18,8 @@ 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])] class UserJob { /** @@ -36,9 +33,8 @@ class UserJob * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] protected ?int $id = null; /** @@ -46,10 +42,9 @@ class UserJob * * @ORM\Column(name="label", type="json") * - * @Serializer\Groups({"read", "docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read', '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..6e2824b88 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php @@ -29,11 +29,8 @@ use Symfony\Component\Validator\Constraints as Assert; * @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])] class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; @@ -100,10 +97,9 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface * * @ORM\OrderBy({"transitionAt": "ASC", "id": "ASC"}) * - * @Assert\Valid(traverse=true) - * * @var Collection */ + #[Assert\Valid(traverse: true)] private Collection $steps; /** diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php index 53e4ad945..509390fac 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php @@ -413,9 +413,7 @@ class EntityWorkflowStep return $this; } - /** - * @Assert\Callback - */ + #[Assert\Callback] public function validateOnCreation(ExecutionContextInterface $context, mixed $payload): void { return; diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php index 8db31c0b1..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, iterable $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(iterable $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 495c5d221..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, iterable $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(iterable $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 4f6022afe..3f1284db8 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/PrivateCommentDataMapper.php @@ -21,7 +21,7 @@ final class PrivateCommentDataMapper extends AbstractType implements DataMapperI { public function __construct(private readonly Security $security) {} - public function mapDataToForms($viewData, iterable $forms) + public function mapDataToForms($viewData, \Traversable $forms) { if (null === $viewData) { return null; @@ -36,7 +36,7 @@ final class PrivateCommentDataMapper extends AbstractType implements DataMapperI $forms['comments']->setData($viewData->getCommentForUser($this->security->getUser())); } - public function mapFormsToData(iterable $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 99dd4b053..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, iterable $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(iterable $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 ef040d16b..d6a0cea20 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php @@ -18,7 +18,7 @@ class ScopePickerDataMapper implements DataMapperInterface { public function __construct(private readonly ?Scope $scope = null) {} - public function mapDataToForms($data, iterable $forms) + public function mapDataToForms($data, \Traversable $forms) { $forms = iterator_to_array($forms); @@ -37,7 +37,7 @@ class ScopePickerDataMapper implements DataMapperInterface } } - public function mapFormsToData(iterable $forms, &$data) + public function mapFormsToData(\Traversable $forms, &$data) { $forms = iterator_to_array($forms); diff --git a/src/Bundle/ChillMainBundle/Form/UserPasswordType.php b/src/Bundle/ChillMainBundle/Form/UserPasswordType.php index 8a5dc01fd..b3ae403a3 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/Search/SearchApiResult.php b/src/Bundle/ChillMainBundle/Search/SearchApiResult.php index 14f448746..9d6a0f948 100644 --- a/src/Bundle/ChillMainBundle/Search/SearchApiResult.php +++ b/src/Bundle/ChillMainBundle/Search/SearchApiResult.php @@ -19,17 +19,13 @@ class SearchApiResult public function __construct(private readonly float $relevance) {} - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public function getRelevance(): float { return $this->relevance; } - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public function getResult() { return $this->result; diff --git a/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php b/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php index c624c6a99..a561fe0bc 100644 --- a/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php +++ b/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php @@ -15,7 +15,6 @@ use Chill\MainBundle\Entity\User; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\NoResultException; use Symfony\Component\Security\Core\Exception\UnsupportedUserException; -use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; @@ -36,7 +35,7 @@ class UserProvider implements UserProviderInterface ->setParameter('pattern', $username) ->getSingleResult(); } catch (NoResultException $e) { - throw new UsernameNotFoundException('Bad credentials.', 0, $e); + throw new \Symfony\Component\Security\Core\Exception\UserNotFoundException('Bad credentials.', 0, $e); } return $user; @@ -51,7 +50,7 @@ class UserProvider implements UserProviderInterface $reloadedUser = $this->em->getRepository(User::class)->find($user->getId()); if (null === $reloadedUser) { - throw new UsernameNotFoundException(sprintf('User with ID "%s" could not be reloaded.', $user->getId())); + throw new \Symfony\Component\Security\Core\Exception\UserNotFoundException(sprintf('User with ID "%s" could not be reloaded.', $user->getId())); } return $reloadedUser; diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php index 4108566ad..8699aded5 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php @@ -16,7 +16,6 @@ use Chill\MainBundle\Repository\UserRepositoryInterface; use Chill\MainBundle\Test\PrepareClientTrait; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; /** * @internal @@ -34,7 +33,7 @@ final class UserControllerTest extends WebTestCase $user = new User(); $user->setUsername('Test_user '.uniqid()); - $user->setPassword(self::getContainer()->get(UserPasswordEncoderInterface::class)->encodePassword( + $user->setPassword(self::getContainer()->get(\Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface::class)->encodePassword( $user, 'password' )); @@ -138,9 +137,9 @@ final class UserControllerTest extends WebTestCase protected function isPasswordValid($username, $password) { - /** @var \Symfony\Component\Security\Core\Encoder\UserPasswordEncoder $passwordEncoder */ + /** @var \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasher $passwordEncoder */ $passwordEncoder = self::getContainer() - ->get(UserPasswordEncoderInterface::class); + ->get(\Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface::class); $user = self::getContainer()->get(UserRepositoryInterface::class) ->findOneBy(['username' => $username]); diff --git a/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php b/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php index fd86aefbf..6472a48f5 100644 --- a/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php +++ b/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php @@ -23,6 +23,8 @@ use Symfony\Component\Console\Output\OutputInterface; final class ChillPersonMoveCommand extends Command { + protected static $defaultDescription = 'Move all the associated entities on a "from" person to a "to" person and remove the old person'; + public function __construct( private readonly PersonMove $mover, private readonly EntityManagerInterface $em, @@ -53,7 +55,6 @@ final class ChillPersonMoveCommand extends Command { $this ->setName('chill:person:move') - ->setDescription('Move all the associated entities on a "from" person to a "to" person and remove the old person') ->addOption('from', 'f', InputOption::VALUE_REQUIRED, 'The person id to delete, all associated data will be moved before') ->addOption('to', 't', InputOption::VALUE_REQUIRED, 'The person id which will received data') ->addOption('dump-sql', null, InputOption::VALUE_NONE, 'dump sql to stdout') @@ -99,7 +100,7 @@ final class ChillPersonMoveCommand extends Command $this->chillLogger->notice('Move a person from command line succeeded', $ctxt); } - return 0; + return Command::SUCCESS; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Bundle/ChillPersonBundle/Command/ImportSocialWorkMetadata.php b/src/Bundle/ChillPersonBundle/Command/ImportSocialWorkMetadata.php index 6c85548dd..6aab04389 100644 --- a/src/Bundle/ChillPersonBundle/Command/ImportSocialWorkMetadata.php +++ b/src/Bundle/ChillPersonBundle/Command/ImportSocialWorkMetadata.php @@ -41,7 +41,6 @@ final class ImportSocialWorkMetadata extends Command ->setName('chill:person:import-socialwork') ->addOption('filepath', 'f', InputOption::VALUE_REQUIRED, 'The file to import.') ->addOption('language', 'l', InputOption::VALUE_OPTIONAL, 'The default language') - ->setDescription($description) ->setHelp($help); } diff --git a/src/Bundle/ChillPersonBundle/Command/RemoveOldDraftAccompanyingPeriodCommand.php b/src/Bundle/ChillPersonBundle/Command/RemoveOldDraftAccompanyingPeriodCommand.php index f826c4d17..43a74a5e1 100644 --- a/src/Bundle/ChillPersonBundle/Command/RemoveOldDraftAccompanyingPeriodCommand.php +++ b/src/Bundle/ChillPersonBundle/Command/RemoveOldDraftAccompanyingPeriodCommand.php @@ -20,6 +20,8 @@ use Symfony\Component\Console\Output\OutputInterface; class RemoveOldDraftAccompanyingPeriodCommand extends Command { + protected static $defaultDescription = 'Remove draft accompanying period which are still draft and unused'; + public function __construct(private readonly LoggerInterface $logger, private readonly OldDraftAccompanyingPeriodRemoverInterface $remover) { parent::__construct('chill:person:remove-old-draft-period'); @@ -28,7 +30,6 @@ class RemoveOldDraftAccompanyingPeriodCommand extends Command protected function configure(): void { $this - ->setDescription('Remove draft accompanying period which are still draft and unused') ->addArgument('interval', InputArgument::OPTIONAL, 'The interval for unactive periods', 'P15D'); } @@ -50,6 +51,6 @@ class RemoveOldDraftAccompanyingPeriodCommand extends Command $this->logger->info('['.$this->getName().'] end of command'); - return 0; + return Command::SUCCESS; } } diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php index 6caa6be4c..262a4a03d 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php @@ -79,9 +79,7 @@ final class AccompanyingCourseApiController extends ApiController ]); } - /** - * @Route("/api/1.0/person/accompanying-course/list/by-recent-attributions") - */ + #[Route(path: '/api/1.0/person/accompanying-course/list/by-recent-attributions')] public function findMyRecentCourseAttribution(Request $request): JsonResponse { $this->denyAccessUnlessGranted('ROLE_USER'); @@ -247,11 +245,7 @@ final class AccompanyingCourseApiController extends ApiController return $this->addRemoveSomething('socialissue', $id, $request, $_format, 'socialIssue', SocialIssue::class, ['groups' => ['read']]); } - /** - * @Route("/api/1.0/person/accompanying-course/{id}/referrers-suggested.{_format}", - * requirements={ "_format": "json"}, - * name="chill_api_person_accompanying_period_referrers_suggested") - */ + #[Route(path: '/api/1.0/person/accompanying-course/{id}/referrers-suggested.{_format}', requirements: ['_format' => 'json'], name: 'chill_api_person_accompanying_period_referrers_suggested')] public function suggestReferrals(AccompanyingPeriod $period, string $_format = 'json'): JsonResponse { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $period); @@ -278,10 +272,9 @@ final class AccompanyingCourseApiController extends ApiController } /** - * @Route("/api/1.0/person/accompanying-course/{id}/confidential.json", name="chill_api_person_accompanying_period_confidential") - * * @ParamConverter("accompanyingCourse", options={"id": "id"}) */ + #[Route(path: '/api/1.0/person/accompanying-course/{id}/confidential.json', name: 'chill_api_person_accompanying_period_confidential')] public function toggleConfidentialApi(AccompanyingPeriod $accompanyingCourse, mixed $id, Request $request) { if ('POST' === $request->getMethod()) { @@ -296,10 +289,9 @@ final class AccompanyingCourseApiController extends ApiController } /** - * @Route("/api/1.0/person/accompanying-course/{id}/intensity.json", name="chill_api_person_accompanying_period_intensity") - * * @ParamConverter("accompanyingCourse", options={"id": "id"}) */ + #[Route(path: '/api/1.0/person/accompanying-course/{id}/intensity.json', name: 'chill_api_person_accompanying_period_intensity')] public function toggleIntensityApi(AccompanyingPeriod $accompanyingCourse, Request $request) { if ('POST' === $request->getMethod()) { diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php index d4a78fc18..f7622953d 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php @@ -41,10 +41,9 @@ class AccompanyingCourseCommentController extends AbstractController /** * Page of comments in Accompanying Course section. * - * @Route("/{_locale}/parcours/{accompanying_period_id}/comments", name="chill_person_accompanying_period_comment_list") - * * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) */ + #[Route(path: '/{_locale}/parcours/{accompanying_period_id}/comments', name: 'chill_person_accompanying_period_comment_list')] public function commentAction(AccompanyingPeriod $accompanyingCourse, Request $request): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE_DETAILS, $accompanyingCourse); @@ -118,12 +117,8 @@ class AccompanyingCourseCommentController extends AbstractController /** * Delete an existing comment. - * - * @Route( - * "/{_locale}/parcours/comment/{id}/delete", - * name="chill_person_accompanying_period_comment_delete" - * ) */ + #[Route(path: '/{_locale}/parcours/comment/{id}/delete', name: 'chill_person_accompanying_period_comment_delete')] public function deleteAction(AccompanyingPeriod\Comment $comment, Request $request): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodCommentVoter::DELETE, $comment); @@ -159,9 +154,7 @@ class AccompanyingCourseCommentController extends AbstractController ]); } - /** - * @Route("/{_locale}/parcours/comment/{id}/pin", name="chill_person_accompanying_period_comment_pin") - */ + #[Route(path: '/{_locale}/parcours/comment/{id}/pin', name: 'chill_person_accompanying_period_comment_pin')] public function pinComment(AccompanyingPeriod\Comment $comment): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $comment->getAccompanyingPeriod()); @@ -177,9 +170,7 @@ class AccompanyingCourseCommentController extends AbstractController ]); } - /** - * @Route("/{_locale}/parcours/comment/{id}/unpin", name="chill_person_accompanying_period_comment_unpin") - */ + #[Route(path: '/{_locale}/parcours/comment/{id}/unpin', name: 'chill_person_accompanying_period_comment_unpin')] public function unpinComment(AccompanyingPeriod\Comment $comment): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $comment->getAccompanyingPeriod()); diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php index 972ed2dd0..1b2362533 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -15,7 +15,6 @@ use Chill\ActivityBundle\Entity\Activity; use Chill\MainBundle\Entity\User; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Household\Household; -use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Form\AccompanyingCourseType; use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository; use Chill\PersonBundle\Repository\PersonRepository; @@ -50,10 +49,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle ) {} /** - * @Route("/{_locale}/parcours/{accompanying_period_id}/close", name="chill_person_accompanying_course_close") - * * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) */ + #[Route(path: '/{_locale}/parcours/{accompanying_period_id}/close', name: 'chill_person_accompanying_course_close')] public function closeAction(AccompanyingPeriod $accompanyingCourse, Request $request): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $accompanyingCourse); @@ -97,10 +95,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle /** * Delete page of Accompanying Course section. * - * @Route("/{_locale}/parcours/{accompanying_period_id}/delete", name="chill_person_accompanying_course_delete") - * * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) */ + #[Route(path: '/{_locale}/parcours/{accompanying_period_id}/delete', name: 'chill_person_accompanying_course_delete')] public function deleteAction(Request $request, AccompanyingPeriod $accompanyingCourse) { $em = $this->managerRegistry->getManager(); @@ -154,10 +151,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle * * the page edit all blocks managed by vuejs component * - * @Route("/{_locale}/parcours/{accompanying_period_id}/edit", name="chill_person_accompanying_course_edit") - * * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) */ + #[Route(path: '/{_locale}/parcours/{accompanying_period_id}/edit', name: 'chill_person_accompanying_course_edit')] public function editAction(AccompanyingPeriod $accompanyingCourse): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $accompanyingCourse); @@ -172,10 +168,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle * * the page show anti chronologic history with all actions, title of page is 'Accompanying Course History' * - * @Route("/{_locale}/parcours/{accompanying_period_id}/history", name="chill_person_accompanying_course_history") - * * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) */ + #[Route(path: '/{_locale}/parcours/{accompanying_period_id}/history', name: 'chill_person_accompanying_course_history')] public function historyAction(AccompanyingPeriod $accompanyingCourse): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $accompanyingCourse); @@ -188,10 +183,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle /** * Homepage of Accompanying Course section. * - * @Route("/{_locale}/parcours/{accompanying_period_id}", name="chill_person_accompanying_course_index") - * * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) */ + #[Route(path: '/{_locale}/parcours/{accompanying_period_id}', name: 'chill_person_accompanying_course_index')] public function indexAction(AccompanyingPeriod $accompanyingCourse): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $accompanyingCourse); @@ -228,9 +222,7 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle ]); } - /** - * @Route("/{_locale}/person/parcours/new", name="chill_person_accompanying_course_new") - */ + #[Route(path: '/{_locale}/person/parcours/new', name: 'chill_person_accompanying_course_new')] public function newAction(Request $request): Response { $user = $this->security->getUser(); @@ -268,9 +260,7 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle ]); } - /** - * @Route("/{_locale}/person/household/parcours/new", name="chill_household_accompanying_course_new") - */ + #[Route(path: '/{_locale}/person/household/parcours/new', name: 'chill_household_accompanying_course_new')] public function newHouseholdParcoursAction(Request $request): Response { $user = $this->getUser(); @@ -308,10 +298,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle } /** - * @Route("/{_locale}/parcours/{accompanying_period_id}/open", name="chill_person_accompanying_course_reopen") - * * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) */ + #[Route(path: '/{_locale}/parcours/{accompanying_period_id}/open', name: 'chill_person_accompanying_course_reopen')] public function reOpenAction(AccompanyingPeriod $accompanyingCourse, Request $request): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $accompanyingCourse); diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php index 9999257a3..98467a302 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php @@ -29,9 +29,7 @@ class AccompanyingCourseWorkApiController extends ApiController private readonly Security $security, ) {} - /** - * @Route("/api/1.0/person/accompanying-period/work/my-near-end") - */ + #[Route(path: '/api/1.0/person/accompanying-period/work/my-near-end')] public function myWorksNearEndDate(Request $request): JsonResponse { $user = $this->security->getUser(); diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php index 591742ee9..fb5b3066c 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php @@ -17,7 +17,6 @@ use Chill\MainBundle\Templating\Listing\FilterOrderHelperFactoryInterface; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork; -use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodWorkVoter; @@ -44,13 +43,7 @@ final class AccompanyingCourseWorkController extends AbstractController private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry ) {} - /** - * @Route( - * "{_locale}/person/accompanying-period/{id}/work/new", - * name="chill_person_accompanying_period_work_new", - * methods={"GET"} - * ) - */ + #[Route(path: '{_locale}/person/accompanying-period/{id}/work/new', name: 'chill_person_accompanying_period_work_new', methods: ['GET'])] public function createWork(AccompanyingPeriod $period): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::CREATE, $period); @@ -77,13 +70,7 @@ final class AccompanyingCourseWorkController extends AbstractController ]); } - /** - * @Route( - * "{_locale}/person/accompanying-period/work/{id}/delete", - * name="chill_person_accompanying_period_work_delete", - * methods={"GET", "POST", "DELETE"} - * ) - */ + #[Route(path: '{_locale}/person/accompanying-period/work/{id}/delete', name: 'chill_person_accompanying_period_work_delete', methods: ['GET', 'POST', 'DELETE'])] public function deleteWork(AccompanyingPeriodWork $work, Request $request): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::UPDATE, $work); @@ -123,13 +110,7 @@ final class AccompanyingCourseWorkController extends AbstractController ]); } - /** - * @Route( - * "{_locale}/person/accompanying-period/work/{id}/edit", - * name="chill_person_accompanying_period_work_edit", - * methods={"GET"} - * ) - */ + #[Route(path: '{_locale}/person/accompanying-period/work/{id}/edit', name: 'chill_person_accompanying_period_work_edit', methods: ['GET'])] public function editWork(AccompanyingPeriodWork $work): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::UPDATE, $work); @@ -143,13 +124,7 @@ final class AccompanyingCourseWorkController extends AbstractController ]); } - /** - * @Route( - * "{_locale}/person/accompanying-period/{id}/work", - * name="chill_person_accompanying_period_work_list", - * methods={"GET"} - * ) - */ + #[Route(path: '{_locale}/person/accompanying-period/{id}/work', name: 'chill_person_accompanying_period_work_list', methods: ['GET'])] public function listWorkByAccompanyingPeriod(AccompanyingPeriod $period): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::SEE, $period); @@ -181,13 +156,7 @@ final class AccompanyingCourseWorkController extends AbstractController ]); } - /** - * @Route( - * "{_locale}/person/accompanying-period/work/{id}/show", - * name="chill_person_accompanying_period_work_show", - * methods={"GET"} - * ) - */ + #[Route(path: '{_locale}/person/accompanying-period/work/{id}/show', name: 'chill_person_accompanying_period_work_show', methods: ['GET'])] public function showWork(AccompanyingPeriodWork $work): Response { if (null === $work) { diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php index 21378b9d7..677040484 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php @@ -22,13 +22,7 @@ class AccompanyingCourseWorkEvaluationDocumentController extends AbstractControl { public function __construct(private readonly Security $security) {} - /** - * @Route( - * "{_locale}/person/accompanying-period/work/evaluation/document/{id}/show", - * name="chill_person_accompanying_period_work_evaluation_document_show", - * methods={"GET"} - * ) - */ + #[Route(path: '{_locale}/person/accompanying-period/work/evaluation/document/{id}/show', name: 'chill_person_accompanying_period_work_evaluation_document_show', methods: ['GET'])] public function showAccompanyingCourseWork(AccompanyingPeriodWorkEvaluationDocument $document): Response { $work = $document->getAccompanyingPeriodWorkEvaluation()->getAccompanyingPeriodWork(); diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php index ed86f02e5..7c18ab8a3 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php @@ -44,9 +44,8 @@ class AccompanyingPeriodController extends AbstractController /** * @throws \Exception - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/close", name="chill_person_accompanying_period_close") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period/close', name: 'chill_person_accompanying_period_close')] public function closeAction(int $person_id, Request $request): Response { $person = $this->_getPerson($person_id); @@ -123,9 +122,7 @@ class AccompanyingPeriodController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/create", name="chill_person_accompanying_period_create") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period/create', name: 'chill_person_accompanying_period_create')] public function createAction(int $person_id, Request $request): Response { $person = $this->_getPerson($person_id); @@ -190,10 +187,9 @@ class AccompanyingPeriodController extends AbstractController } /** - * @ParamConverter("person", options={"id": "person_id"}) - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period", name="chill_person_accompanying_period_list") + * @ParamConverter("person", options={"id"="person_id"}) */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period', name: 'chill_person_accompanying_period_list')] public function listAction(Person $person): Response { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $person); @@ -218,9 +214,7 @@ class AccompanyingPeriodController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/open", name="chill_person_accompanying_period_open") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period/open', name: 'chill_person_accompanying_period_open')] public function openAction(int $person_id, Request $request): Response { $person = $this->_getPerson($person_id); @@ -303,9 +297,7 @@ class AccompanyingPeriodController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/{period_id}/re-open", name="chill_person_accompanying_period_re_open") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period/{period_id}/re-open', name: 'chill_person_accompanying_period_re_open')] public function reOpenAction(int $person_id, int $period_id, Request $request): Response { /** @var Person $person */ @@ -353,9 +345,8 @@ class AccompanyingPeriodController extends AbstractController /** * @throws Exception - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/{period_id}/update", name="chill_person_accompanying_period_update") */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period/{period_id}/update', name: 'chill_person_accompanying_period_update')] public function updateAction(int $person_id, int $period_id, Request $request): Response { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php index f5516114f..a3ce3ef13 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodRegulationListController.php @@ -33,9 +33,7 @@ class AccompanyingPeriodRegulationListController { public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} - /** - * @Route("/{_locale}/person/periods/undispatched", name="chill_person_course_list_regulation") - */ + #[Route(path: '/{_locale}/person/periods/undispatched', name: 'chill_person_course_list_regulation')] public function listRegul(Request $request): Response { if (!$this->security->isGranted('ROLE_USER') || !$this->security->getUser() instanceof User) { diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php index 60b8e9cff..1be5543d1 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php @@ -31,10 +31,7 @@ class AccompanyingPeriodWorkEvaluationApiController { public function __construct(private readonly AccompanyingPeriodWorkEvaluationRepository $accompanyingPeriodWorkEvaluationRepository, private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly SerializerInterface $serializer, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security) {} - /** - * @Route("/api/1.0/person/docgen/template/by-evaluation/{id}.{_format}", - * requirements={"format": "json"}) - */ + #[Route(path: '/api/1.0/person/docgen/template/by-evaluation/{id}.{_format}', requirements: ['format' => 'json'])] public function listTemplateByEvaluation(Evaluation $evaluation, string $_format): JsonResponse { if ('json' !== $_format) { @@ -64,9 +61,7 @@ class AccompanyingPeriodWorkEvaluationApiController ), JsonResponse::HTTP_OK, [], true); } - /** - * @Route("/api/1.0/person/accompanying-period/work/evaluation/my-near-end") - */ + #[Route(path: '/api/1.0/person/accompanying-period/work/evaluation/my-near-end')] public function myWorksNearEndDate(Request $request): JsonResponse { $total = $this->accompanyingPeriodWorkEvaluationRepository diff --git a/src/Bundle/ChillPersonBundle/Controller/AdminController.php b/src/Bundle/ChillPersonBundle/Controller/AdminController.php index 7f973d50a..970010e20 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AdminController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AdminController.php @@ -19,33 +19,25 @@ use Symfony\Component\Routing\Annotation\Route; */ class AdminController extends AbstractController { - /** - * @Route("/{_locale}/admin/accompanying-course", name="chill_accompanying-course_admin_index") - */ + #[Route(path: '/{_locale}/admin/accompanying-course', name: 'chill_accompanying-course_admin_index')] public function indexAccompanyingCourseAdminAction() { return $this->render('@ChillPerson/Admin/indexAccompanyingCourse.html.twig'); } - /** - * @Route("/{_locale}/admin/household", name="chill_household_admin_index") - */ + #[Route(path: '/{_locale}/admin/household', name: 'chill_household_admin_index')] public function indexHouseholdAdminAction() { return $this->render('@ChillPerson/Admin/indexHousehold.html.twig'); } - /** - * @Route("/{_locale}/admin/person", name="chill_person_admin_index") - */ + #[Route(path: '/{_locale}/admin/person', name: 'chill_person_admin_index')] public function indexPersonAdminAction() { return $this->render('@ChillPerson/Admin/indexPerson.html.twig'); } - /** - * @Route("/{_locale}/admin/social-work", name="chill_social-work_admin_index") - */ + #[Route(path: '/{_locale}/admin/social-work', name: 'chill_social-work_admin_index')] public function indexSocialWorkAdminAction() { return $this->render('@ChillPerson/Admin/indexSocialWork.html.twig'); @@ -53,9 +45,8 @@ class AdminController extends AbstractController /** * @return \Symfony\Component\HttpFoundation\RedirectResponse - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/person_redirect_to_main", name="chill_person_admin_redirect_to_admin_index", options={null}) */ + #[Route(path: '/{_locale}/admin/person_redirect_to_main', name: 'chill_person_admin_redirect_to_admin_index', options: [null])] public function redirectToAdminIndexAction() { return $this->redirectToRoute('chill_main_admin_central'); diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php index a6d5ed2c5..05e73ad2a 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php @@ -34,11 +34,9 @@ class HouseholdApiController extends ApiController public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly HouseholdRepository $householdRepository, private readonly HouseholdACLAwareRepositoryInterface $householdACLAwareRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} /** - * @Route("/api/1.0/person/household/by-address-reference/{id}.json", - * name="chill_api_person_household_by_address_reference") - * * @return \Symfony\Component\HttpFoundation\JsonResponse */ + #[Route(path: '/api/1.0/person/household/by-address-reference/{id}.json', name: 'chill_api_person_household_by_address_reference')] public function getHouseholdByAddressReference(AddressReference $addressReference): Response { $this->denyAccessUnlessGranted('ROLE_USER'); @@ -59,10 +57,8 @@ class HouseholdApiController extends ApiController /** * Add an address to a household. - * - * @Route("/api/1.0/person/household/{id}/address.{_format}", name="chill_api_single_household_address", - * methods={"POST"}, requirements={"_format": "json"}) */ + #[Route(path: '/api/1.0/person/household/{id}/address.{_format}', name: 'chill_api_single_household_address', methods: ['POST'], requirements: ['_format' => 'json'])] public function householdAddressApi(Household $household, Request $request, string $_format): Response { $this->denyAccessUnlessGranted(HouseholdVoter::EDIT, $household); @@ -104,15 +100,9 @@ class HouseholdApiController extends ApiController } /** - * @Route("/api/1.0/person/address/suggest/by-household/{household_id}.{_format}", - * name="chill_person_address_suggest_by_household", - * requirements={ - * "_format": "json" - * } - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/api/1.0/person/address/suggest/by-household/{household_id}.{_format}', name: 'chill_person_address_suggest_by_household', requirements: ['_format' => 'json'])] public function suggestAddressByHousehold(Household $household, string $_format) { // TODO add acl diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php index 00503ab3e..0da3688f9 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php @@ -46,9 +46,7 @@ class HouseholdCompositionController extends AbstractController private readonly UrlGeneratorInterface $urlGenerator ) {} - /** - * @Route("/{_locale}/person/household/{household_id}/composition/{composition_id}/delete", name="chill_person_household_composition_delete") - */ + #[Route(path: '/{_locale}/person/household/{household_id}/composition/{composition_id}/delete', name: 'chill_person_household_composition_delete')] public function deleteAction(Request $request, mixed $household_id, mixed $composition_id): Response { $composition = $this->householdCompositionRepository->find($composition_id); @@ -95,9 +93,7 @@ class HouseholdCompositionController extends AbstractController ); } - /** - * @Route("/{_locale}/person/household/{id}/composition/index", name="chill_person_household_composition_index") - */ + #[Route(path: '/{_locale}/person/household/{id}/composition/index', name: 'chill_person_household_composition_index')] public function index(Household $household, Request $request): Response { if (!$this->security->isGranted(HouseholdVoter::SEE, $household)) { @@ -122,9 +118,7 @@ class HouseholdCompositionController extends AbstractController )); } - /** - * @Route("/{_locale}/person/household/{id}/composition/new", name="chill_person_household_composition_new") - */ + #[Route(path: '/{_locale}/person/household/{id}/composition/new', name: 'chill_person_household_composition_new')] public function newAction(Household $household, Request $request): Response { if ($this->security->isGranted(HouseholdVoter::EDIT, $household)) { diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php index ae74d365b..83a195c5b 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php @@ -29,22 +29,15 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; use Symfony\Component\Serializer\SerializerInterface; use Symfony\Contracts\Translation\TranslatorInterface; -/** - * @Route("/{_locale}/person/household") - */ +#[Route(path: '/{_locale}/person/household')] class HouseholdController extends AbstractController { public function __construct(private readonly TranslatorInterface $translator, private readonly PositionRepository $positionRepository, private readonly SerializerInterface $serializer, private readonly Security $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} /** - * @Route( - * "/{household_id}/accompanying-period", - * name="chill_person_household_accompanying_period", - * methods={"GET", "HEAD"} - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/{household_id}/accompanying-period', name: 'chill_person_household_accompanying_period', methods: ['GET', 'HEAD'])] public function accompanyingPeriod(Request $request, Household $household) { $currentMembers = $household->getCurrentPersons(); @@ -92,14 +85,9 @@ class HouseholdController extends AbstractController } /** - * @Route( - * "/{household_id}/address/edit", - * name="chill_person_household_address_edit", - * methods={"GET", "HEAD", "POST"} - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/{household_id}/address/edit', name: 'chill_person_household_address_edit', methods: ['GET', 'HEAD', 'POST'])] public function addressEdit(Request $request, Household $household) { // TODO ACL @@ -119,14 +107,9 @@ class HouseholdController extends AbstractController } /** - * @Route( - * "/{household_id}/addresses", - * name="chill_person_household_addresses", - * methods={"GET", "HEAD"} - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/{household_id}/addresses', name: 'chill_person_household_addresses', methods: ['GET', 'HEAD'])] public function addresses(Request $request, Household $household) { // TODO ACL @@ -150,14 +133,9 @@ class HouseholdController extends AbstractController } /** - * @Route( - * "/{household_id}/address/move", - * name="chill_person_household_address_move", - * methods={"GET", "HEAD", "POST"} - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/{household_id}/address/move', name: 'chill_person_household_address_move', methods: ['GET', 'HEAD', 'POST'])] public function addressMove(Request $request, Household $household) { // TODO ACL @@ -171,14 +149,9 @@ class HouseholdController extends AbstractController } /** - * @Route( - * "/{household_id}/address/edit_valid_from", - * name="chill_person_household_address_valid_from_edit", - * methods={"GET", "HEAD", "POST"} - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/{household_id}/address/edit_valid_from', name: 'chill_person_household_address_valid_from_edit', methods: ['GET', 'HEAD', 'POST'])] public function addressValidFromEdit(Request $request, Household $household) { $this->denyAccessUnlessGranted(HouseholdVoter::EDIT, $household); @@ -228,14 +201,9 @@ class HouseholdController extends AbstractController } /** - * @Route( - * "/{household_id}/members/metadata/edit", - * name="chill_person_household_members_metadata_edit", - * methods={"GET", "POST"} - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/{household_id}/members/metadata/edit', name: 'chill_person_household_members_metadata_edit', methods: ['GET', 'POST'])] public function editHouseholdMetadata(Request $request, Household $household) { // TODO ACL @@ -260,14 +228,9 @@ class HouseholdController extends AbstractController } /** - * @Route( - * "/{household_id}/relationship", - * name="chill_person_household_relationship", - * methods={"GET", "HEAD"} - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/{household_id}/relationship', name: 'chill_person_household_relationship', methods: ['GET', 'HEAD'])] public function showRelationship(Request $request, Household $household) { $jsonString = $this->serializer->serialize( @@ -286,14 +249,9 @@ class HouseholdController extends AbstractController } /** - * @Route( - * "/{household_id}/summary", - * name="chill_person_household_summary", - * methods={"GET", "HEAD"} - * ) - * * @ParamConverter("household", options={"id": "household_id"}) */ + #[Route(path: '/{household_id}/summary', name: 'chill_person_household_summary', methods: ['GET', 'HEAD'])] public function summary(Request $request, Household $household) { // TODO ACL diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php index aa2f80a43..07ab6da70 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php @@ -47,12 +47,7 @@ class HouseholdMemberController extends ApiController private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, ) {} - /** - * @Route( - * "/{_locale}/person/household/member/{id}/edit", - * name="chill_person_household_member_edit" - * ) - */ + #[Route(path: '/{_locale}/person/household/member/{id}/edit', name: 'chill_person_household_member_edit')] public function editMembership(Request $request, HouseholdMember $member): Response { // TODO ACL @@ -90,12 +85,8 @@ class HouseholdMemberController extends ApiController * * household: the id of the destination household * * allow_leave_without_household: if present, the editor will allow * to leave household without joining another - * - * @Route( - * "/{_locale}/person/household/members/editor", - * name="chill_person_household_members_editor" - * ) */ + #[Route(path: '/{_locale}/person/household/members/editor', name: 'chill_person_household_members_editor')] public function editor(Request $request) { $ids = $request->query->all('persons'); @@ -173,12 +164,7 @@ class HouseholdMemberController extends ApiController ]); } - /** - * @Route( - * "/api/1.0/person/household/members/move.{_format}", - * name="chill_api_person_household_members_move" - * ) - */ + #[Route(path: '/api/1.0/person/household/members/move.{_format}', name: 'chill_api_person_household_members_move')] public function move(Request $request, mixed $_format): Response { try { diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php index b1df6cb16..13b1fc7ca 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php @@ -31,9 +31,7 @@ class PersonAddressController extends AbstractController */ public function __construct(private readonly ValidatorInterface $validator, private readonly TranslatorInterface $translator, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/create", name="chill_person_address_create", methods={"POST"}) - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/address/create', name: 'chill_person_address_create', methods: ['POST'])] public function createAction(mixed $person_id, Request $request) { $person = $this->managerRegistry->getManager() @@ -88,9 +86,7 @@ class PersonAddressController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/{address_id}/edit", name="chill_person_address_edit") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/address/{address_id}/edit', name: 'chill_person_address_edit')] public function editAction(mixed $person_id, mixed $address_id) { $person = $this->managerRegistry->getManager() @@ -118,9 +114,7 @@ class PersonAddressController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/list", name="chill_person_address_list") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/address/list', name: 'chill_person_address_list')] public function listAction(mixed $person_id) { $person = $this->managerRegistry->getManager() @@ -142,9 +136,7 @@ class PersonAddressController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/new", name="chill_person_address_new") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/address/new', name: 'chill_person_address_new')] public function newAction(mixed $person_id) { $person = $this->managerRegistry->getManager() @@ -171,9 +163,7 @@ class PersonAddressController extends AbstractController ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/{address_id}/update", name="chill_person_address_update") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/address/{address_id}/update', name: 'chill_person_address_update')] public function updateAction(mixed $person_id, mixed $address_id, Request $request) { $person = $this->managerRegistry->getManager() diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php index 01008f240..6a1820b24 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php @@ -36,11 +36,7 @@ class PersonApiController extends ApiController $this->showCenters = $parameterBag->get('chill_main')['acl']['form_show_centers']; } - /** - * @Route("/api/1.0/person/creation/authorized-centers", - * name="chill_person_person_creation_authorized_centers" - * ) - */ + #[Route(path: '/api/1.0/person/creation/authorized-centers', name: 'chill_person_person_creation_authorized_centers')] public function authorizedCentersForCreation(): Response { $centers = $this->authorizedCenterOnPersonCreation->getCenters(); @@ -53,14 +49,7 @@ class PersonApiController extends ApiController ); } - /** - * @Route("/api/1.0/person/config/alt_names.{_format}", - * name="chill_person_config_alt_names", - * requirements={ - * "_format": "json" - * } - * ) - */ + #[Route(path: '/api/1.0/person/config/alt_names.{_format}', name: 'chill_person_config_alt_names', requirements: ['_format' => 'json'])] public function configAltNames(Request $request, string $_format): Response { $configAltNamesChoices = $this->configPersonAltNameHelper->getChoices(); @@ -83,15 +72,9 @@ class PersonApiController extends ApiController } /** - * @Route("/api/1.0/person/address/suggest/by-person/{person_id}.{_format}", - * name="chill_person_address_suggest_by_person", - * requirements={ - * "_format": "json" - * } - * ) - * * @ParamConverter("person", options={"id": "person_id"}) */ + #[Route(path: '/api/1.0/person/address/suggest/by-person/{person_id}.{_format}', name: 'chill_person_address_suggest_by_person', requirements: ['_format' => 'json'])] public function suggestAddress(Person $person, Request $request, string $_format): Response { $this->denyAccessUnlessGranted(PersonVoter::SEE, $person); diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php index 3d8d1bdbe..9f35e1b5c 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php @@ -49,9 +49,7 @@ final class PersonController extends AbstractController private readonly EntityManagerInterface $em, ) {} - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/general/edit", name="chill_person_general_edit") - */ + #[Route(path: '/{_locale}/person/{person_id}/general/edit', name: 'chill_person_general_edit')] public function editAction(int $person_id, Request $request) { $person = $this->_getPerson($person_id); @@ -116,14 +114,9 @@ final class PersonController extends AbstractController } /** - * @Route( - * "/{_locale}/person/household/{person_id}/history", - * name="chill_person_household_person_history", - * methods={"GET", "POST"} - * ) - * * @ParamConverter("person", options={"id": "person_id"}) */ + #[Route(path: '/{_locale}/person/household/{person_id}/history', name: 'chill_person_household_person_history', methods: ['GET', 'POST'])] public function householdHistoryByPerson(Request $request, Person $person): Response { $this->denyAccessUnlessGranted( @@ -146,14 +139,13 @@ final class PersonController extends AbstractController /** * Method for creating a new person. * - *The controller register data from a previous post on the form, and + * The controller register data from a previous post on the form, and * register it in the session. * * The next post compare the data with previous one and, if yes, show a * review page if there are "alternate persons". - * - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/new", name="chill_person_new") */ + #[Route(path: '/{_locale}/person/new', name: 'chill_person_new')] public function newAction(Request $request): Response { $person = new Person(); @@ -248,9 +240,7 @@ final class PersonController extends AbstractController ); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/general", name="chill_person_view") - */ + #[Route(path: '/{_locale}/person/{person_id}/general', name: 'chill_person_view')] public function viewAction(int $person_id) { $person = $this->_getPerson($person_id); diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php index 119780b47..b11390a46 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php @@ -42,9 +42,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, ) {} - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/confirm", name="chill_person_duplicate_confirm") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person1_id}/duplicate/{person2_id}/confirm', name: 'chill_person_duplicate_confirm')] public function confirmAction(mixed $person1_id, mixed $person2_id, Request $request) { if ($person1_id === $person2_id) { @@ -104,9 +102,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/find-manually", name="chill_person_find_manually_duplicate") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/find-manually', name: 'chill_person_find_manually_duplicate')] public function findManuallyDuplicateAction(mixed $person_id, Request $request) { $person = $this->_getPerson($person_id); @@ -155,9 +151,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll ]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/not-duplicate", name="chill_person_duplicate_not_duplicate") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person1_id}/duplicate/{person2_id}/not-duplicate', name: 'chill_person_duplicate_not_duplicate')] public function notDuplicateAction(mixed $person1_id, mixed $person2_id) { $user = $this->security->getUser(); @@ -190,9 +184,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/remove-not-duplicate", name="chill_person_remove_duplicate_not_duplicate") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person1_id}/duplicate/{person2_id}/remove-not-duplicate', name: 'chill_person_remove_duplicate_not_duplicate')] public function removeNotDuplicateAction(mixed $person1_id, mixed $person2_id) { [$person1, $person2] = $this->_getPersonsByPriority($person1_id, $person2_id); @@ -214,9 +206,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/duplicate/view", name="chill_person_duplicate_view") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/duplicate/view', name: 'chill_person_duplicate_view')] public function viewAction(mixed $person_id, PersonNotDuplicateRepository $personNotDuplicateRepository) { $person = $this->_getPerson($person_id); diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php index a9d60d18e..079830cf7 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php @@ -27,9 +27,7 @@ final class PersonResourceController extends AbstractController { public function __construct(private readonly PersonResourceRepository $personResourceRepository, private readonly PersonRepository $personRepository, private readonly EntityManagerInterface $em, private readonly TranslatorInterface $translator) {} - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/{resource_id}/delete", name="chill_person_resource_delete") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/resources/{resource_id}/delete', name: 'chill_person_resource_delete')] public function deleteAction(Request $request, mixed $person_id, mixed $resource_id): Response { $personOwner = $this->personRepository->find($person_id); @@ -76,9 +74,7 @@ final class PersonResourceController extends AbstractController ); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/{resource_id}/edit", name="chill_person_resource_edit") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/resources/{resource_id}/edit', name: 'chill_person_resource_edit')] public function editAction(Request $request, mixed $resource_id, mixed $person_id): Response { $resource = $this->personResourceRepository->find($resource_id); @@ -113,9 +109,7 @@ final class PersonResourceController extends AbstractController ); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/list", name="chill_person_resource_list") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/resources/list', name: 'chill_person_resource_list')] public function listAction(Request $request, mixed $person_id) { $personOwner = $this->personRepository->find($person_id); @@ -133,9 +127,7 @@ final class PersonResourceController extends AbstractController ); } - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/new", name="chill_person_resource_new") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/resources/new', name: 'chill_person_resource_new')] public function newAction(Request $request, mixed $person_id) { $personOwner = $this->personRepository->find($person_id); diff --git a/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php index 7cd95773e..6e3fa5117 100644 --- a/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/ReassignAccompanyingPeriodController.php @@ -41,9 +41,7 @@ class ReassignAccompanyingPeriodController extends AbstractController { public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly UserRepository $userRepository, private readonly AccompanyingPeriodRepository $courseRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly UserRender $userRender, private readonly EntityManagerInterface $em) {} - /** - * @Route("/{_locale}/person/accompanying-periods/reassign", name="chill_course_list_reassign") - */ + #[Route(path: '/{_locale}/person/accompanying-periods/reassign', name: 'chill_course_list_reassign')] public function listAction(Request $request): Response { if (!$this->security->isGranted(AccompanyingPeriodVoter::REASSIGN_BULK)) { diff --git a/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php b/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php index 4cf3e0d6e..dc3c8ee0a 100644 --- a/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php +++ b/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php @@ -29,9 +29,7 @@ final class ResidentialAddressController extends AbstractController { public function __construct(private readonly UrlGeneratorInterface $generator, private readonly TranslatorInterface $translator, private readonly ResidentialAddressRepository $residentialAddressRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} - /** - * @Route("/{_locale}/person/residential-address/{id}/delete", name="chill_person_residential_address_delete") - */ + #[Route(path: '/{_locale}/person/residential-address/{id}/delete', name: 'chill_person_residential_address_delete')] public function deleteAction(Request $request, ResidentialAddress $residentialAddress): Response { $this->denyAccessUnlessGranted(PersonVoter::UPDATE, $residentialAddress->getPerson()); @@ -57,9 +55,7 @@ final class ResidentialAddressController extends AbstractController ]); } - /** - * @Route("/{_locale}/person/residential-address/{id}/edit", name="chill_person_residential_address_edit") - */ + #[Route(path: '/{_locale}/person/residential-address/{id}/edit', name: 'chill_person_residential_address_edit')] public function editAction(Request $request, ResidentialAddress $residentialAddress): Response { if ($request->query->has('kind')) { @@ -93,9 +89,7 @@ final class ResidentialAddressController extends AbstractController ]); } - /** - * @Route("/{_locale}/person/{id}/residential-address/list", name="chill_person_residential_address_list") - */ + #[Route(path: '/{_locale}/person/{id}/residential-address/list', name: 'chill_person_residential_address_list')] public function listAction(Request $request, Person $person): Response { $this->denyAccessUnlessGranted(PersonVoter::SEE, $person); @@ -108,9 +102,7 @@ final class ResidentialAddressController extends AbstractController ]); } - /** - * @Route("/{_locale}/person/{id}/residential-address/new", name="chill_person_residential_address_new") - */ + #[Route(path: '/{_locale}/person/{id}/residential-address/new', name: 'chill_person_residential_address_new')] public function newAction(Request $request, Person $person): Response { $residentialAddress = new ResidentialAddress(); diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php index b97f2ed30..27a7acbf5 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php @@ -25,15 +25,9 @@ class SocialWorkEvaluationApiController extends AbstractController public function __construct(private readonly PaginatorFactory $paginatorFactory) {} /** - * @Route("/api/1.0/person/social-work/evaluation/by-social-action/{action_id}.json", - * name="chill_person_evaluation_index_by_social_action", - * requirements={ - * "_format": "json" - * } - * ) - * * @ParamConverter("action", options={"id": "action_id"}) */ + #[Route(path: '/api/1.0/person/social-work/evaluation/by-social-action/{action_id}.json', name: 'chill_person_evaluation_index_by_social_action', requirements: ['_format' => 'json'])] public function listEvaluationBySocialAction(SocialAction $action): Response { $evaluations = $action->getEvaluations()->filter(static fn (Evaluation $eval) => $eval->isActive()); diff --git a/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php b/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php index 5cfc26cc7..0cd86eb5b 100644 --- a/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/TimelinePersonController.php @@ -24,9 +24,7 @@ class TimelinePersonController extends AbstractController { public function __construct(protected EventDispatcherInterface $eventDispatcher, protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} - /** - * @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/timeline", name="chill_person_timeline") - */ + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/timeline', name: 'chill_person_timeline')] public function personAction(Request $request, mixed $person_id) { $person = $this->managerRegistry diff --git a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php index 1f484fd91..adaaa27d0 100644 --- a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php @@ -23,9 +23,7 @@ class UserAccompanyingPeriodController extends AbstractController { public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly PaginatorFactory $paginatorFactory) {} - /** - * @Route("/{_locale}/person/accompanying-periods/my", name="chill_person_accompanying_period_user") - */ + #[Route(path: '/{_locale}/person/accompanying-periods/my', name: 'chill_person_accompanying_period_user')] public function listAction(Request $request): Response { $active = $request->query->getBoolean('active', true); @@ -56,9 +54,7 @@ class UserAccompanyingPeriodController extends AbstractController ]); } - /** - * @Route("/{_locale}/person/accompanying-periods/my/drafts", name="chill_person_accompanying_period_draft_user") - */ + #[Route(path: '/{_locale}/person/accompanying-periods/my/drafts', name: 'chill_person_accompanying_period_draft_user')] public function listDraftsAction(): Response { $total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser(), 'step' => 'DRAFT']); diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index a38b7055c..27a217987 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -58,18 +58,14 @@ use UnexpectedValueException; * * @ORM\Table(name="chill_person_accompanying_period") * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "accompanying_period": AccompanyingPeriod::class - * }) - * - * @Assert\GroupSequenceProvider - * * @AccompanyingPeriodValidity(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED}) * * @LocationValidity(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED}) * * @ConfidentialCourseMustHaveReferrer(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED}) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period' => AccompanyingPeriod::class])] +#[Assert\GroupSequenceProvider] class AccompanyingPeriod implements GroupSequenceProviderInterface, HasCentersInterface, @@ -144,11 +140,9 @@ class AccompanyingPeriod implements /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location") - * - * @Groups({"read", "write"}) - * - * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED}) */ + #[Groups(['read', 'write'])] + #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])] private ?Location $administrativeLocation = null; /** @@ -160,17 +154,10 @@ class AccompanyingPeriod implements /** * @ORM\Column(type="date", nullable=true) - * - * @Groups({"read", "write", "docgen:read"}) - * - * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CLOSED}) - * - * @Assert\GreaterThanOrEqual( - * propertyPath="openingDate", - * groups={AccompanyingPeriod::STEP_CLOSED}, - * message="The closing date must be later than the date of creation" - * ) */ + #[Groups(['read', 'write', 'docgen:read'])] + #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])] + #[Assert\GreaterThanOrEqual(propertyPath: 'openingDate', groups: [AccompanyingPeriod::STEP_CLOSED], message: 'The closing date must be later than the date of creation')] private ?\DateTime $closingDate = null; /** @@ -178,11 +165,9 @@ class AccompanyingPeriod implements * targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive") * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read", "write"}) - * - * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CLOSED}) */ + #[Groups(['read', 'write'])] + #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])] private ?ClosingMotive $closingMotive = null; /** @@ -194,40 +179,35 @@ class AccompanyingPeriod implements * * @ORM\OrderBy({"createdAt": "DESC", "id": "DESC"}) * - * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_DRAFT}) - * * @var Collection */ + #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_DRAFT])] private Collection $comments; /** * @ORM\Column(type="boolean", options={"default": false}) - * - * @Groups({"read", "write", "docgen:read"}) */ + #[Groups(['read', 'write', 'docgen:read'])] private bool $confidential = false; /** * @ORM\Column(type="datetime", nullable=true, options={"default": NULL}) - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private ?\DateTimeInterface $createdAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?User $createdBy = null; /** * @ORM\Column(type="boolean", options={"default": false}) - * - * @Groups({"read", "write", "docgen:read"}) */ + #[Groups(['read', 'write', 'docgen:read'])] private bool $emergency = false; /** @@ -236,29 +216,24 @@ class AccompanyingPeriod implements * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="string", nullable=true) - * - * @Groups({"read"}) - * - * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED}) */ + #[Groups(['read'])] + #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])] private ?string $intensity = self::INTENSITY_OCCASIONAL; /** * @ORM\ManyToOne( * targetEntity=UserJob::class * ) - * - * @Groups({"read", "write"}) - * - * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED}) */ + #[Groups(['read', 'write'])] + #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])] private ?UserJob $job = null; /** @@ -271,24 +246,19 @@ class AccompanyingPeriod implements /** * @ORM\Column(type="date") - * - * @Groups({"read", "write", "docgen:read"}) - * - * @Assert\LessThan(value="tomorrow", groups={AccompanyingPeriod::STEP_CONFIRMED}) - * - * @Assert\LessThanOrEqual(propertyPath="closingDate", groups={AccompanyingPeriod::STEP_CONFIRMED}) */ + #[Groups(['read', 'write', 'docgen:read'])] + #[Assert\LessThan(value: 'tomorrow', groups: [AccompanyingPeriod::STEP_CONFIRMED])] + #[Assert\LessThanOrEqual(propertyPath: 'closingDate', groups: [AccompanyingPeriod::STEP_CONFIRMED])] private ?\DateTime $openingDate = null; /** * @ORM\ManyToOne(targetEntity=Origin::class) * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read", "write"}) - * - * @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED}) */ + #[Groups(['read', 'write'])] + #[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])] private ?Origin $origin = null; /** @@ -296,12 +266,11 @@ class AccompanyingPeriod implements * mappedBy="accompanyingPeriod", orphanRemoval=true, * cascade={"persist", "refresh", "remove", "merge", "detach"}) * - * @Groups({"read", "docgen:read"}) - * * @ParticipationOverlap(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED}) * * @var Collection */ + #[Groups(['read', 'docgen:read'])] private Collection $participations; /** @@ -318,26 +287,23 @@ class AccompanyingPeriod implements * cascade={"persist"}, * ) * - * @Groups({"read"}) - * * @ORM\JoinColumn(onDelete="SET NULL") */ + #[Groups(['read'])] private ?Comment $pinnedComment = null; private bool $preventUserIsChangedNotification = false; /** * @ORM\Column(type="text") - * - * @Groups({"read", "write"}) */ + #[Groups(['read', 'write'])] private string $remark = ''; /** * @ORM\Column(type="boolean", options={"default": false}) - * - * @Groups({"read", "write", "docgen:read"}) */ + #[Groups(['read', 'write', 'docgen:read'])] private bool $requestorAnonymous = false; /** @@ -364,10 +330,9 @@ class AccompanyingPeriod implements * orphanRemoval=true * ) * - * @Groups({"read", "docgen:read"}) - * * @ResourceDuplicateCheck(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED, "Default", "default"}) */ + #[Groups(['read', 'docgen:read'])] private Collection $resources; /** @@ -383,11 +348,9 @@ class AccompanyingPeriod implements * joinColumns={@ORM\JoinColumn(name="accompanying_period_id", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="scope_id", referencedColumnName="id")} * ) - * - * @Groups({"read", "docgen:read"}) - * - * @Assert\Count(min=1, groups={AccompanyingPeriod::STEP_CONFIRMED}, minMessage="A course must be associated to at least one scope") */ + #[Groups(['read', 'docgen:read'])] + #[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must be associated to at least one scope')] private Collection $scopes; /** @@ -400,20 +363,17 @@ class AccompanyingPeriod implements * @ORM\JoinTable( * name="chill_person_accompanying_period_social_issues" * ) - * - * @Groups({"read", "docgen:read"}) - * - * @Assert\Count(min=1, groups={AccompanyingPeriod::STEP_CONFIRMED}, minMessage="A course must contains at least one social issue") */ + #[Groups(['read', 'docgen:read'])] + #[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must contains at least one social issue')] private Collection $socialIssues; /** * @ORM\Column(type="string", length=32, nullable=true) * - * @Groups({"read"}) - * * @var AccompanyingPeriod::STEP_* */ + #[Groups(['read'])] private ?string $step = self::STEP_DRAFT; /** @@ -440,9 +400,8 @@ class AccompanyingPeriod implements * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read", "write", "docgen:read"}) */ + #[Groups(['read', 'write', 'docgen:read'])] private ?User $user = null; /** @@ -469,9 +428,8 @@ class AccompanyingPeriod implements * targetEntity=AccompanyingPeriodWork::class, * mappedBy="accompanyingPeriod" * ) - * - * @Assert\Valid(traverse=true) */ + #[Assert\Valid(traverse: true)] private Collection $works; /** @@ -749,10 +707,9 @@ class AccompanyingPeriod implements } /** - * @Groups({"read"}) - * * @return ReadableCollection<(int|string), Comment> */ + #[Groups(['read'])] public function getComments(): ReadableCollection { $pinnedComment = $this->pinnedComment; @@ -775,9 +732,7 @@ class AccompanyingPeriod implements return $this->createdBy; } - /** - * @Groups({"docgen:read"}) - */ + #[Groups(['docgen:read'])] public function getCurrentParticipations(): ReadableCollection { return $this->getOpenParticipations(); @@ -826,9 +781,8 @@ class AccompanyingPeriod implements /** * Get the location, taking precedence into account. - * - * @Groups({"read"}) */ + #[Groups(['read'])] public function getLocation(?\DateTimeImmutable $at = null): ?Address { if ($this->getPersonLocation() instanceof Person) { @@ -849,10 +803,9 @@ class AccompanyingPeriod implements /** * Get where the location is. * - * @Groups({"read"}) - * * @return 'person'|'address'|'none' */ + #[Groups(['read'])] public function getLocationStatus(): string { if ($this->getPersonLocation() instanceof Person) { @@ -949,9 +902,7 @@ class AccompanyingPeriod implements ); } - /** - * @Groups({"read"}) - */ + #[Groups(['read'])] public function getPersonLocation(): ?Person { return $this->personLocation; @@ -971,9 +922,7 @@ class AccompanyingPeriod implements ); } - /** - * @Groups({"read"}) - */ + #[Groups(['read'])] public function getPinnedComment(): ?Comment { return $this->pinnedComment; @@ -1026,9 +975,7 @@ class AccompanyingPeriod implements return $this->remark; } - /** - * @Groups({"read"}) - */ + #[Groups(['read'])] public function getRequestor(): Person|ThirdParty|null { return $this->requestorPerson ?? $this->requestorThirdParty; @@ -1254,9 +1201,7 @@ class AccompanyingPeriod implements return $this; } - /** - * @Groups({"write"}) - */ + #[Groups(['write'])] public function setAddressLocation(?Address $addressLocation = null): self { if ($this->addressLocation !== $addressLocation) { @@ -1369,9 +1314,7 @@ class AccompanyingPeriod implements return $this; } - /** - * @Groups({"write"}) - */ + #[Groups(['write'])] public function setPersonLocation(?Person $person = null): self { if ($this->personLocation !== $person) { @@ -1391,9 +1334,7 @@ class AccompanyingPeriod implements return $this; } - /** - * @Groups({"write"}) - */ + #[Groups(['write'])] public function setPinnedComment(?Comment $comment = null): self { if (null !== $this->pinnedComment) { @@ -1421,9 +1362,8 @@ class AccompanyingPeriod implements * @param $requestor Person|ThirdParty * * @throw UnexpectedValueException if the requestor is not a Person or ThirdParty - * - * @Groups({"write"}) */ + #[Groups(['write'])] public function setRequestor($requestor): self { if ($requestor instanceof Person) { diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index 618918695..dcf154b8b 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -33,23 +33,16 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\Entity * * @ORM\Table(name="chill_person_accompanying_period_work") - * - * @Serializer\DiscriminatorMap( - * typeProperty="type", - * mapping={ - * "accompanying_period_work": AccompanyingPeriodWork::class - * } - * ) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work' => AccompanyingPeriodWork::class])] class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, TrackCreationInterface, TrackUpdateInterface { /** * @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class) * - * @Serializer\Groups({"read", "read:accompanyingPeriodWork:light"}) - * * @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"}) */ + #[Serializer\Groups(['read', 'read:accompanyingPeriodWork:light'])] private ?AccompanyingPeriod $accompanyingPeriod = null; /** @@ -60,57 +53,46 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * orphanRemoval=true * ) * - * @Serializer\Groups({"read", "docgen:read"}) - * * @ORM\OrderBy({"startDate": "DESC", "id": "DESC"}) * * @var Collection * * @internal /!\ the serialization for write evaluations is handled in `AccompanyingPeriodWorkDenormalizer` */ + #[Serializer\Groups(['read', 'docgen:read'])] private Collection $accompanyingPeriodWorkEvaluations; /** * @ORM\Column(type="datetime_immutable") - * - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])] private ?\DateTimeImmutable $createdAt = null; /** * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])] private bool $createdAutomatically = false; /** * @ORM\Column(type="text") - * - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])] private string $createdAutomaticallyReason = ''; /** * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=false) - * - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])] private ?User $createdBy = null; /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"accompanying_period_work:create"}) - * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) - * - * @Assert\GreaterThanOrEqual(propertyPath="startDate", - * message="accompanying_course_work.The endDate should be greater or equal than the start date" - * ) */ + #[Serializer\Groups(['accompanying_period_work:create', 'accompanying_period_work:edit', 'read', 'docgen:read', 'read:accompanyingPeriodWork:light'])] + #[Assert\GreaterThanOrEqual(propertyPath: 'startDate', message: 'accompanying_course_work.The endDate should be greater or equal than the start date')] private ?\DateTimeImmutable $endDate = null; /** @@ -122,20 +104,14 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * cascade={"persist"}, * orphanRemoval=true * ) - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"accompanying_period_work:edit"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])] private Collection $goals; /** * @ORM\ManyToOne(targetEntity=ThirdParty::class) - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"accompanying_period_work:edit"}) - * - * In schema : traitant */ + #[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])] private ?ThirdParty $handlingThierParty = null; /** @@ -144,16 +120,14 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light", "read:evaluation:include-work"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'read:evaluation:include-work'])] private ?int $id = null; /** * @ORM\Column(type="text") - * - * @Serializer\Groups({"read", "accompanying_period_work:edit", "docgen:read"}) */ + #[Serializer\Groups(['read', 'accompanying_period_work:edit', 'docgen:read'])] private string $note = ''; /** @@ -162,18 +136,14 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * @ORM\ManyToMany(targetEntity=Person::class) * * @ORM\JoinTable(name="chill_person_accompanying_period_work_person") - * - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) - * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"accompanying_period_work:create"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:edit', 'accompanying_period_work:create'])] private Collection $persons; /** * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_") - * - * @Serializer\Groups({"read", "accompanying_period_work:edit"}) */ + #[Serializer\Groups(['read', 'accompanying_period_work:edit'])] private PrivateCommentEmbeddable $privateComment; /** @@ -189,29 +159,22 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorks") * * @ORM\JoinTable(name="chill_person_accompanying_period_work_result") - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"accompanying_period_work:edit"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])] private Collection $results; /** * @ORM\ManyToOne(targetEntity=SocialAction::class) * - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) - * @Serializer\Groups({"accompanying_period_work:create"}) - * * @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:create'])] private ?SocialAction $socialAction = null; /** * @ORM\Column(type="date_immutable") - * - * @Serializer\Groups({"accompanying_period_work:create"}) - * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ + #[Serializer\Groups(['accompanying_period_work:create', 'accompanying_period_work:edit', 'read', 'docgen:read', 'read:accompanyingPeriodWork:light'])] private ?\DateTimeImmutable $startDate = null; /** @@ -222,35 +185,30 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * @ORM\JoinTable(name="chill_person_accompanying_period_work_third_party") * * In schema : intervenants - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"accompanying_period_work:edit"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])] private Collection $thirdParties; /** * @ORM\Column(type="datetime_immutable") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?\DateTimeImmutable $updatedAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=false) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?User $updatedBy = null; /** * @ORM\Column(type="integer", nullable=false, options={"default": 1}) * - * @Serializer\Groups({"read", "accompanying_period_work:edit"}) - * * @ORM\Version */ + #[Serializer\Groups(['read', 'accompanying_period_work:edit'])] private int $version = 1; public function __construct() @@ -394,11 +352,8 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues /** * @return ReadableCollection - * - * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) - * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"accompanying_period_work:create"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:edit', 'accompanying_period_work:create'])] public function getReferrers(): ReadableCollection { $users = $this->referrersHistory diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php index 7f2fc981c..18993c3d9 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php @@ -25,11 +25,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table("chill_person_accompanying_period_work_evaluation") - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "accompanying_period_work_evaluation": AccompanyingPeriodWorkEvaluation::class, - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_evaluation' => AccompanyingPeriodWorkEvaluation::class])] class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackUpdateInterface { /** @@ -38,35 +35,29 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU * inversedBy="accompanyingPeriodWorkEvaluations" * ) * - * @Serializer\Groups({"read:evaluation:include-work"}) - * * @Serializer\Context(normalizationContext={"groups": {"read:accompanyingPeriodWork:light"}}, groups={"read:evaluation:include-work"}) */ + #[Serializer\Groups(['read:evaluation:include-work'])] private ?AccompanyingPeriodWork $accompanyingPeriodWork = null; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])] private string $comment = ''; /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?\DateTimeImmutable $createdAt = null; /** * @ORM\ManyToOne( * targetEntity=User::class * ) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?User $createdBy = null; /** @@ -83,29 +74,23 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU * * @ORM\OrderBy({"createdAt": "DESC", "id": "DESC"}) * - * @Serializer\Groups({"read"}) - * * @var Collection */ + #[Serializer\Groups(['read'])] private Collection $documents; /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])] private ?\DateTimeImmutable $endDate = null; /** * @ORM\ManyToOne( * targetEntity=Evaluation::class * ) - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work_evaluation:create'])] private ?Evaluation $evaluation = null; /** @@ -114,9 +99,8 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** @@ -125,63 +109,46 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU * * This data is not persisted into database, but will appears on the data * normalized during the same request (like PUT/PATCH request) - * - * @Serializer\Groups({"read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])] private $key; /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])] private ?\DateTimeImmutable $maxDate = null; /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])] private ?\DateTimeImmutable $startDate = null; /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?\DateTimeImmutable $updatedAt = null; /** * @ORM\ManyToOne( * targetEntity=User::class * ) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?User $updatedBy = null; /** * @ORM\Column(type="dateinterval", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])] private ?\DateInterval $warningInterval = null; /** * @ORM\Column(type="integer", nullable=true) - * - * @Serializer\Groups({"read", "docgen:read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])] private ?int $timeSpent = null; public function __construct() @@ -270,9 +237,7 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU return $this->updatedBy; } - /** - * @Serializer\Groups({"docgen:read"}) - */ + #[Serializer\Groups(['docgen:read'])] public function getWarningDate(): ?\DateTimeImmutable { if (null === $this->getEndDate() || null === $this->getWarningInterval()) { diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php index e5ddc059a..d20e8d7ed 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php @@ -23,11 +23,8 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\Entity * * @ORM\Table("chill_person_accompanying_period_work_evaluation_document") - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "accompanying_period_work_evaluation_document": AccompanyingPeriodWorkEvaluationDocument::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_evaluation_document' => AccompanyingPeriodWorkEvaluationDocument::class])] class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doctrine\Model\TrackCreationInterface, \Chill\MainBundle\Doctrine\Model\TrackUpdateInterface { use TrackCreationTrait; @@ -52,10 +49,8 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct * @internal the default name exceeds 64 characters, we must set manually: * * @ORM\SequenceGenerator(sequenceName="chill_person_social_work_eval_doc_id_seq", allocationSize=1, initialValue=1000) - * - * @Serializer\Groups({"read"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'accompanying_period_work_evaluation:create'])] private ?int $id = null; /** @@ -64,43 +59,31 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct * * This data is not persisted into database, but will appears on the data * normalized during the same request (like PUT/PATCH request) - * - * @Serializer\Groups({"read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])] private $key; /** * @ORM\ManyToOne( * targetEntity=StoredObject::class, * ) - * - * @Serializer\Groups({"read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) - * - * @Assert\Valid */ + #[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])] + #[Assert\Valid] private ?StoredObject $storedObject = null; /** * @ORM\ManyToOne( * targetEntity=DocGeneratorTemplate::class * ) - * - * @Serializer\Groups({"read"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'accompanying_period_work_evaluation:create'])] private ?DocGeneratorTemplate $template = null; /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) - * - * @Serializer\Groups({"read"}) - * @Serializer\Groups({"write"}) - * @Serializer\Groups({"accompanying_period_work_evaluation:create"}) */ + #[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])] private ?string $title = ''; public function getAccompanyingPeriodWorkEvaluation(): ?AccompanyingPeriodWorkEvaluation diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkGoal.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkGoal.php index c0a1528ad..bdd30eec3 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkGoal.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkGoal.php @@ -22,14 +22,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table(name="chill_person_accompanying_period_work_goal") - * - * @Serializer\DiscriminatorMap( - * typeProperty="type", - * mapping={ - * "accompanying_period_work_goal": AccompanyingPeriodWorkGoal::class - * } - * ) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_goal' => AccompanyingPeriodWorkGoal::class])] class AccompanyingPeriodWorkGoal { /** @@ -39,10 +33,8 @@ class AccompanyingPeriodWorkGoal /** * @ORM\ManyToOne(targetEntity=Goal::class) - * - * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['accompanying_period_work:edit', 'read', 'docgen:read'])] private ?Goal $goal = null; /** @@ -51,17 +43,14 @@ class AccompanyingPeriodWorkGoal * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="text") - * - * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['accompanying_period_work:edit', 'read'])] private string $note = ''; /** @@ -70,10 +59,8 @@ class AccompanyingPeriodWorkGoal * @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorkGoals") * * @ORM\JoinTable(name="chill_person_accompanying_period_work_goal_result") - * - * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['accompanying_period_work:edit', 'read', 'docgen:read'])] private Collection $results; public function __construct() diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/ClosingMotive.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/ClosingMotive.php index 97938dafc..dc12bff2a 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/ClosingMotive.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/ClosingMotive.php @@ -47,18 +47,16 @@ class ClosingMotive * @ORM\Column(name="id", type="integer") * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="json") * - * @Serializer\Groups({"docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private array $name = []; /** diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php index c972f453a..b230b4b18 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php @@ -24,11 +24,8 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\Entity * * @ORM\Table(name="chill_person_accompanying_period_comment") - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "accompanying_period_comment": Comment::class - * }) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_comment' => Comment::class])] class Comment implements TrackCreationInterface, TrackUpdateInterface { /** @@ -42,29 +39,24 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="text", nullable=false, options={"default":""}) - * - * @Groups({"read", "write", "docgen:read"}) - * - * @Assert\NotBlank - * - * @Assert\NotNull */ + #[Groups(['read', 'write', 'docgen:read'])] + #[Assert\NotBlank] + #[Assert\NotNull] private string $content = ''; /** * @ORM\Column(type="datetime") - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?\DateTimeInterface $createdAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=false) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?User $creator = null; /** @@ -73,25 +65,22 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="datetime") - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?\DateTimeInterface $updatedAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) * * @ORM\JoinColumn(nullable=false) - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?User $updatedBy = null; public function getAccompanyingPeriod(): ?AccompanyingPeriod diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php index 979fd4581..565f6f789 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php @@ -18,13 +18,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table(name="chill_person_accompanying_period_origin") - * - * @Serializer\DiscriminatorMap( - * typeProperty="type", - * mapping={ - * "origin": Origin::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['origin' => Origin::class])] class Origin { /** @@ -33,25 +28,22 @@ class Origin * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] 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'])] private array $label = []; /** * @ORM\Column(type="date_immutable", nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?\DateTimeImmutable $noActiveAfter = null; public function getId(): ?int diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php index f0ff1d956..e5e5a6091 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php @@ -31,11 +31,12 @@ use Symfony\Component\Serializer\Annotation\Groups; * @ORM\UniqueConstraint(name="thirdparty_unique", columns={"thirdparty_id", "accompanyingperiod_id"}) * } * ) - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "accompanying_period_resource": Resource::class - * }) + * @ORM\UniqueConstraint(name="person_unique", columns={"person_id", "accompanyingperiod_id"}), + * @ORM\UniqueConstraint(name="thirdparty_unique", columns={"thirdparty_id", "accompanyingperiod_id"}) + * } + * ) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_resource' => Resource::class])] class Resource { /** @@ -50,9 +51,8 @@ class Resource /** * @ORM\Column(type="text", nullable=true) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?string $comment = ''; /** @@ -61,27 +61,24 @@ class Resource * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\ManyToOne(targetEntity=Person::class) * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private ?Person $person = null; /** * @ORM\ManyToOne(targetEntity=ThirdParty::class) * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"docgen:read"}) */ + #[Groups(['docgen:read'])] private ?ThirdParty $thirdParty = null; public function getAccompanyingPeriod(): ?AccompanyingPeriod @@ -104,9 +101,7 @@ class Resource return $this->person; } - /** - * @Groups({"read"}) - */ + #[Groups(['read'])] public function getResource(): Person|ThirdParty|null { return $this->person ?? $this->thirdParty; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriodParticipation.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriodParticipation.php index 964f66f1a..2a04bbff5 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriodParticipation.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriodParticipation.php @@ -21,18 +21,14 @@ use Symfony\Component\Serializer\Annotation\Groups; * @ORM\Entity * * @ORM\Table(name="chill_person_accompanying_period_participation") - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "accompanying_period_participation": AccompanyingPeriodParticipation::class - * }) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_participation' => AccompanyingPeriodParticipation::class])] class AccompanyingPeriodParticipation { /** * @ORM\Column(type="date", nullable=true) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?\DateTime $endDate = null; /** @@ -41,16 +37,14 @@ class AccompanyingPeriodParticipation * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="date", nullable=false) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?\DateTime $startDate = null; public function __construct(/** @@ -59,12 +53,11 @@ class AccompanyingPeriodParticipation * @ORM\JoinColumn(name="accompanyingperiod_id", referencedColumnName="id", nullable=false) */ private ?AccompanyingPeriod $accompanyingPeriod, /** - * @ORM\ManyToOne(targetEntity=Person::class, inversedBy="accompanyingPeriodParticipations") - * - * @ORM\JoinColumn(name="person_id", referencedColumnName="id", nullable=false) - * - * @Groups({"read", "docgen:read"}) - */ + * @ORM\ManyToOne(targetEntity=Person::class, inversedBy="accompanyingPeriodParticipations") + * + * @ORM\JoinColumn(name="person_id", referencedColumnName="id", nullable=false) + */ + #[Groups(['read', 'docgen:read'])] private ?Person $person ) { $this->startDate = new \DateTime('now'); diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php index cc0ff2d69..45f6eb3a3 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php @@ -32,12 +32,9 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * name="chill_person_household" * ) * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "household": Household::class - * }) - * * @MaxHolder(groups={"household_memberships"}) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household' => Household::class])] class Household { /** @@ -52,9 +49,8 @@ class Household * @ORM\JoinTable(name="chill_person_household_to_addresses") * * @ORM\OrderBy({"validFrom": "DESC", "id": "DESC"}) - * - * @Serializer\Groups({"write"}) */ + #[Serializer\Groups(['write'])] private Collection $addresses; /** @@ -73,9 +69,8 @@ class Household * ) * * @ORM\OrderBy({"startDate": "DESC"}) - * - * @Assert\Valid(traverse=true, groups={"household_composition"}) */ + #[Assert\Valid(traverse: true, groups: ['household_composition'])] private Collection&Selectable $compositions; /** @@ -84,9 +79,8 @@ class Household * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** @@ -96,23 +90,20 @@ class Household * targetEntity=HouseholdMember::class, * mappedBy="household" * ) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private Collection $members; /** * @ORM\Column(type="boolean", name="waiting_for_birth", options={"default": false}) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private bool $waitingForBirth = false; /** * @ORM\Column(type="date_immutable", name="waiting_for_birth_date", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?\DateTimeImmutable $waitingForBirthDate = null; public function __construct() @@ -159,8 +150,6 @@ class Household * By default, the addresses are ordered by date, descending (the most * recent first). * - * @Assert\Callback(methods={"validate"}) - * * @return Collection
*/ public function getAddresses(): Collection @@ -209,11 +198,8 @@ class Household return $this->compositions; } - /** - * @Serializer\Groups({"read", "docgen:read"}) - * - * @Serializer\SerializedName("current_address") - */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[Serializer\SerializedName('current_address')] public function getCurrentAddress(?\DateTime $at = null): ?Address { $at ??= new \DateTime('today'); @@ -229,11 +215,8 @@ class Household return null; } - /** - * @Serializer\Groups({"docgen:read"}) - * - * @Serializer\SerializedName("current_composition") - */ + #[Serializer\Groups(['docgen:read'])] + #[Serializer\SerializedName('current_composition')] public function getCurrentComposition(?\DateTimeImmutable $at = null): ?HouseholdComposition { $at ??= new \DateTimeImmutable('today'); @@ -259,9 +242,7 @@ class Household return null; } - /** - * @Serializer\Groups({"docgen:read"}) - */ + #[Serializer\Groups(['docgen:read'])] public function getCurrentMembers(?\DateTimeImmutable $now = null): Collection { return $this->getMembers()->matching($this->buildCriteriaCurrentMembers($now)); @@ -281,11 +262,9 @@ class Household * get current members ids. * * Used in serialization - * - * @Serializer\Groups({"read"}) - * - * @Serializer\SerializedName("current_members_id") */ + #[Serializer\Groups(['read'])] + #[Serializer\SerializedName('current_members_id')] public function getCurrentMembersIds(?\DateTimeImmutable $now = null): ReadableCollection { return $this->getCurrentMembers($now)->map( @@ -606,9 +585,8 @@ class Household * This will force the startDate's address on today. * * Used on household creation. - * - * @Serializer\Groups({"create"}) */ + #[Serializer\Groups(['create'])] public function setForceAddress(Address $address) { $address->setValidFrom(new \DateTime('today')); @@ -629,6 +607,7 @@ class Household return $this; } + #[Assert\Callback] public function validate(ExecutionContextInterface $context, $payload) { $addresses = $this->getAddresses(); diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdComposition.php b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdComposition.php index d8eab9bef..77f2a5994 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdComposition.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdComposition.php @@ -26,11 +26,8 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\Table( * name="chill_person_household_composition" * ) - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "household_composition_type": HouseholdCompositionType::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_composition_type' => HouseholdCompositionType::class])] class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; @@ -44,11 +41,9 @@ class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterfa /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Assert\GreaterThanOrEqual(propertyPath="startDate", groups={"Default", "household_composition"}) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Assert\GreaterThanOrEqual(propertyPath: 'startDate', groups: ['Default', 'household_composition'])] + #[Serializer\Groups(['docgen:read'])] private ?\DateTimeImmutable $endDate = null; /** @@ -62,9 +57,8 @@ class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterfa * @ORM\ManyToOne(targetEntity=HouseholdCompositionType::class) * * @ORM\JoinColumn(nullable=false) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?HouseholdCompositionType $householdCompositionType = null; /** @@ -73,29 +67,23 @@ class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterfa * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="integer", nullable=true, options={"default": null}) - * - * @Assert\NotNull - * - * @Assert\GreaterThanOrEqual(0, groups={"Default", "household_composition"}) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Assert\NotNull] + #[Assert\GreaterThanOrEqual(0, groups: ['Default', 'household_composition'])] + #[Serializer\Groups(['docgen:read'])] private ?int $numberOfChildren = null; /** * @ORM\Column(type="date_immutable", nullable=false) - * - * @Assert\NotNull(groups={"Default", "household_composition"}) - * - * @Serializer\Groups({"docgen:read"}) */ + #[Assert\NotNull(groups: ['Default', 'household_composition'])] + #[Serializer\Groups(['docgen:read'])] private ?\DateTimeImmutable $startDate = null; public function __construct() diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdCompositionType.php b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdCompositionType.php index cb1fe2703..2b3773bdf 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdCompositionType.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdCompositionType.php @@ -20,11 +20,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Table( * name="chill_person_household_composition_type" * ) - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "household_composition_type": HouseholdCompositionType::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_composition_type' => HouseholdCompositionType::class])] class HouseholdCompositionType { /** @@ -38,18 +35,16 @@ class HouseholdCompositionType * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] 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'])] private array $label = []; public function getId(): ?int diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php index 21c28f52e..09a32b2e2 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php @@ -27,40 +27,30 @@ class HouseholdMember { /** * @ORM\Column(type="string", length=255, nullable=true) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?string $comment = null; /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read", "docgen:read"}) - * - * @Assert\GreaterThanOrEqual( - * propertyPath="startDate", - * message="household_membership.The end date must be after start date", - * groups={"household_memberships"} - * ) */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[Assert\GreaterThanOrEqual(propertyPath: 'startDate', message: 'household_membership.The end date must be after start date', groups: ['household_memberships'])] private ?\DateTimeImmutable $endDate = null; /** * @ORM\Column(type="boolean", options={"default": false}) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private bool $holder = false; /** * @ORM\ManyToOne( * targetEntity="\Chill\PersonBundle\Entity\Household\Household" * ) - * - * @Assert\Valid(groups={"household_memberships"}) - * - * @Assert\NotNull(groups={"household_memberships"}) */ + #[Assert\Valid(groups: ['household_memberships'])] + #[Assert\NotNull(groups: ['household_memberships'])] private ?Household $household = null; /** @@ -69,9 +59,8 @@ class HouseholdMember * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** @@ -79,21 +68,17 @@ class HouseholdMember * targetEntity="\Chill\PersonBundle\Entity\Person" * ) * - * @Serializer\Groups({"read", "docgen:read"}) - * * @Serializer\Context({"docgen:person:with-household": false}) - * - * @Assert\Valid(groups={"household_memberships"}) - * - * @Assert\NotNull(groups={"household_memberships"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[Assert\Valid(groups: ['household_memberships'])] + #[Assert\NotNull(groups: ['household_memberships'])] private ?Person $person = null; /** * @ORM\ManyToOne(targetEntity=Position::class) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?Position $position = null; /** @@ -103,11 +88,9 @@ class HouseholdMember /** * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read", "docgen:read"}) - * - * @Assert\NotNull(groups={"household_memberships"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] + #[Assert\NotNull(groups: ['household_memberships'])] private ?\DateTimeImmutable $startDate = null; public function getComment(): ?string @@ -140,9 +123,7 @@ class HouseholdMember return $this->position; } - /** - * @Serializer\Groups({"read"}) - */ + #[Serializer\Groups(['read'])] public function getShareHousehold(): ?bool { return $this->shareHousehold; diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/Position.php b/src/Bundle/ChillPersonBundle/Entity/Household/Position.php index 2252fca97..2080fceb1 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/Position.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/Position.php @@ -18,18 +18,14 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table(name="chill_person_household_position") - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "household_position": Position::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_position' => Position::class])] class Position { /** * @ORM\Column(type="boolean") - * - * @Serializer\Groups({ "read" }) */ + #[Serializer\Groups(['read'])] private bool $allowHolder = false; /** @@ -38,32 +34,28 @@ class Position * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] 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'])] private array $label = []; /** * @ORM\Column(type="float") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private float $ordering = 0.00; /** * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $shareHouseHold = true; public function getAllowHolder(): bool diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index 3ee30ac87..50c17cc19 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -62,19 +62,25 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * columns={"birthdate"} * ) * }) + * @ORM\Index( + * name="person_names", + * columns={"firstName", "lastName"} + * ), + * @ORM\Index( + * name="person_birthdate", + * columns={"birthdate"} + * ) + * }) * * @ORM\HasLifecycleCallbacks * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "person": Person::class - * }) - * * @PersonHasCenter * * @HouseholdMembershipSequential( * groups={"household_memberships"} * ) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['person' => Person::class])] class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface, \Stringable { final public const BOTH_GENDER = 'both'; @@ -282,35 +288,27 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * The person's deathdate. * * @ORM\Column(type="date_immutable", nullable=true) - * - * @Assert\Date - * - * @Assert\GreaterThanOrEqual(propertyPath="birthdate") - * - * @Assert\LessThanOrEqual("today") */ + #[Assert\Date] + #[Assert\GreaterThanOrEqual(propertyPath: 'birthdate')] + #[Assert\LessThanOrEqual('today')] private ?\DateTimeImmutable $deathdate = null; /** * The person's email. * * @ORM\Column(type="text", nullable=true) - * - * @Assert\Email() */ + #[Assert\Email] private ?string $email = ''; /** * The person's first name. * * @ORM\Column(type="string", length=255) - * - * @Assert\NotBlank(message="The firstname cannot be empty") - * - * @Assert\Length( - * max=255, - * ) */ + #[Assert\NotBlank(message: 'The firstname cannot be empty')] + #[Assert\Length(max: 255)] private string $firstName = ''; /** @@ -325,9 +323,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * The person's gender. * * @ORM\Column(type="string", length=9, nullable=true) - * - * @Assert\NotNull(message="The gender must be set") */ + #[Assert\NotNull(message: 'The gender must be set')] private ?string $gender = null; /** @@ -374,13 +371,9 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * The person's last name. * * @ORM\Column(type="string", length=255) - * - * @Assert\NotBlank(message="The lastname cannot be empty") - * - * @Assert\Length( - * max=255, - * ) */ + #[Assert\NotBlank(message: 'The lastname cannot be empty')] + #[Assert\Length(max: 255)] private string $lastName = ''; /** @@ -403,9 +396,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * The date of the last marital status change of the person. * * @ORM\Column(type="date", nullable=true) - * - * @Assert\Date */ + #[Assert\Date] private ?\DateTime $maritalStatusDate = null; /** @@ -451,11 +443,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * cascade={"persist", "remove", "merge", "detach"}, * orphanRemoval=true * ) - * - * @Assert\Valid( - * traverse=true, - * ) */ + #[Assert\Valid(traverse: true)] private Collection $otherPhoneNumbers; /** @@ -1410,11 +1399,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * Validation callback that checks if the accompanying periods are valid. * * This method add violation errors. - * - * @Assert\Callback( - * groups={"accompanying_period_consistent"} - * ) */ + #[Assert\Callback(groups: ['accompanying_period_consistent'])] public function isAccompanyingPeriodValid(ExecutionContextInterface $context) { $r = $this->checkAccompanyingPeriodsAreNotCollapsing(); @@ -1439,11 +1425,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * two addresses with the same validFrom date). * * This method add violation errors. - * - * @Assert\Callback( - * groups={"addresses_consistent"} - * ) */ + #[Assert\Callback(groups: ['addresses_consistent'])] public function isAddressesValid(ExecutionContextInterface $context) { if ($this->hasTwoAdressWithSameValidFromDate()) { diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php index c5c2c8d08..de30f059c 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php @@ -28,11 +28,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * @ORM\Entity * * @ORM\Table(name="chill_person_resource") - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "personResource": personResource::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['personResource' => PersonResource::class])] class PersonResource implements TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; @@ -41,16 +38,14 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private CommentEmbeddable $comment; /** * @ORM\Column(type="text", nullable=true) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?string $freeText = null; /** @@ -59,18 +54,16 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\ManyToOne(targetEntity=PersonResourceKind::class, inversedBy="personResources") * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?PersonResourceKind $kind = null; /** @@ -79,9 +72,8 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface * @ORM\ManyToOne(targetEntity=Person::class) * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?Person $person = null; /** @@ -90,18 +82,16 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface * @ORM\ManyToOne(targetEntity=Person::class, inversedBy="resources") * * @ORM\JoinColumn(nullable=false) - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?Person $personOwner = null; /** * @ORM\ManyToOne(targetEntity=ThirdParty::class, inversedBy="personResources") * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read", "docgen:read"}) */ + #[Groups(['read', 'docgen:read'])] private ?ThirdParty $thirdParty = null; public function __construct() @@ -142,9 +132,7 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface return $this->personOwner; } - /** - * @Groups({"read", "docgen:read"}) - */ + #[Groups(['read', 'docgen:read'])] public function getResourceKind(): string { if ($this->getPerson() instanceof Person) { @@ -234,9 +222,7 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface return $this; } - /** - * @Assert\Callback - */ + #[Assert\Callback] public function validate(ExecutionContextInterface $context, mixed $payload) { if (null === $this->person && null === $this->thirdParty && (null === $this->freeText || '' === $this->freeText)) { diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResourceKind.php b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResourceKind.php index f036e4b4a..03def4e4d 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResourceKind.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResourceKind.php @@ -27,9 +27,8 @@ class PersonResourceKind * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?int $id = null; /** @@ -40,10 +39,9 @@ class PersonResourceKind /** * @ORM\Column(type="json", length=255) * - * @Serializer\Groups({"docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private array $title; public function getId(): ?int diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/ResidentialAddress.php b/src/Bundle/ChillPersonBundle/Entity/Person/ResidentialAddress.php index acd312190..7317a7eba 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person/ResidentialAddress.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person/ResidentialAddress.php @@ -31,9 +31,8 @@ class ResidentialAddress * @ORM\ManyToOne(targetEntity=Address::class) * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?Address $address = null; /** @@ -43,9 +42,8 @@ class ResidentialAddress /** * @ORM\Column(type="datetime_immutable", nullable=true) - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?\DateTimeImmutable $endDate = null; /** @@ -53,19 +51,17 @@ class ResidentialAddress * * @ORM\JoinColumn(nullable=true) * - * @Groups({"read"}) - * * @Context(normalizationContext={"groups": {"minimal"}}) */ + #[Groups(['read'])] private ?Person $hostPerson = null; /** * @ORM\ManyToOne(targetEntity=ThirdParty::class) * * @ORM\JoinColumn(nullable=true) - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?ThirdParty $hostThirdParty = null; /** @@ -86,9 +82,8 @@ class ResidentialAddress /** * @ORM\Column(type="datetime_immutable") - * - * @Groups({"read"}) */ + #[Groups(['read'])] private ?\DateTimeImmutable $startDate = null; public function __construct() diff --git a/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php b/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php index c17172882..e31c8b877 100644 --- a/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php +++ b/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php @@ -34,16 +34,14 @@ class PersonAltName /** * @ORM\Column(name="key", type="string", length=255) - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $key = ''; /** * @ORM\Column(name="label", type="text") - * - * @Groups({"write"}) */ + #[Groups(['write'])] private string $label = ''; /** diff --git a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relation.php b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relation.php index a8c542622..ab60a06d9 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relation.php +++ b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relation.php @@ -19,11 +19,8 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap; * @ORM\Entity * * @ORM\Table(name="chill_person_relations") - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "relation": Relation::class - * }) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['relation' => Relation::class])] class Relation { /** @@ -32,34 +29,30 @@ class Relation * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="boolean", nullable=true) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $isActive = true; /** * @ORM\Column(type="json", nullable=true) * - * @Serializer\Groups({"read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read'])] private array $reverseTitle = []; /** * @ORM\Column(type="json", nullable=true) * - * @Serializer\Groups({"read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read'])] private array $title = []; public function getId(): ?int diff --git a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php index ce56fa013..d0a7f5fd9 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php +++ b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php @@ -30,12 +30,9 @@ use Symfony\Component\Validator\Constraints as Assert; * * @DiscriminatorColumn(name="relation_id", type="integer") * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "relationship": Relationship::class - * }) - * * @RelationshipNoDuplicate */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['relationship' => Relationship::class])] class Relationship implements TrackCreationInterface, TrackUpdateInterface { /** @@ -54,11 +51,9 @@ class Relationship implements TrackCreationInterface, TrackUpdateInterface * @ORM\ManyToOne(targetEntity=Person::class) * * @ORM\JoinColumn(nullable=false) - * - * @Assert\NotNull - * - * @Serializer\Groups({"read", "write"}) */ + #[Assert\NotNull] + #[Serializer\Groups(['read', 'write'])] private ?Person $fromPerson = null; /** @@ -67,43 +62,33 @@ class Relationship implements TrackCreationInterface, TrackUpdateInterface * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?int $id = null; /** * @ORM\ManyToOne(targetEntity=Relation::class) * * @ORM\JoinColumn(nullable=false, name="relation_id", referencedColumnName="id") - * - * @Assert\NotNull - * - * @Serializer\Groups({"read", "write"}) */ + #[Assert\NotNull] + #[Serializer\Groups(['read', 'write'])] private ?Relation $relation = null; /** * @ORM\Column(type="boolean") - * - * @Assert\Type( - * type="bool", - * message="This must be of type boolean" - * ) - * - * @Serializer\Groups({"read", "write"}) */ + #[Assert\Type(type: 'bool', message: 'This must be of type boolean')] + #[Serializer\Groups(['read', 'write'])] private bool $reverse; /** * @ORM\ManyToOne(targetEntity=Person::class) * * @ORM\JoinColumn(nullable=false) - * - * @Assert\NotNull - * - * @Serializer\Groups({"read", "write"}) */ + #[Assert\NotNull] + #[Serializer\Groups(['read', 'write'])] private ?Person $toPerson = null; /** diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php index 4ec5bcf78..d7ada64d2 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php @@ -21,11 +21,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table(name="chill_person_social_work_evaluation") - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "social_work_evaluation": Evaluation::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['social_work_evaluation' => Evaluation::class])] class Evaluation { /** @@ -35,9 +32,8 @@ class Evaluation /** * @ORM\Column(type="dateinterval", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?\DateInterval $delay = null; /** @@ -46,16 +42,14 @@ class Evaluation * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="dateinterval", nullable=true, options={"default": null}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?\DateInterval $notificationDelay = null; /** @@ -71,17 +65,15 @@ class Evaluation /** * @ORM\Column(type="json") * - * @Serializer\Groups({"read", "docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private array $title = []; /** * @ORM\Column(type="text", nullable=true) - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?string $url = null; public function __construct() diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Goal.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Goal.php index 856e565eb..85a8d3607 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Goal.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Goal.php @@ -20,14 +20,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table(name="chill_person_social_work_goal") - * - * @Serializer\DiscriminatorMap( - * typeProperty="type", - * mapping={ - * "social_work_goal": Goal::class - * } - * ) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['social_work_goal' => Goal::class])] class Goal { /** @@ -41,9 +35,8 @@ class Goal * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** @@ -65,10 +58,9 @@ class Goal /** * @ORM\Column(type="json") * - * @Serializer\Groups({"read", "docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private array $title = []; public function __construct() diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Result.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Result.php index c8afb0456..6cb1d1db4 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Result.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Result.php @@ -23,14 +23,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table(name="chill_person_social_work_result") - * - * @Serializer\DiscriminatorMap( - * typeProperty="type", - * mapping={ - * "social_work_result": Result::class - * } - * ) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['social_work_result' => Result::class])] class Result { /** @@ -65,9 +59,8 @@ class Result * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"read", "docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private ?int $id = null; /** @@ -80,10 +73,9 @@ class Result /** * @ORM\Column(type="json") * - * @Serializer\Groups({"read", "docgen:read"}) - * * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ + #[Serializer\Groups(['read', 'docgen:read'])] private array $title = []; public function __construct() diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php index 19fd7395b..5aafef643 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php @@ -22,14 +22,8 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Entity * * @ORM\Table(name="chill_person_social_action") - * - * @Serializer\DiscriminatorMap( - * typeProperty="type", - * mapping={ - * "social_work_social_action": SocialAction::class - * } - * ) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['social_work_social_action' => SocialAction::class])] class SocialAction { /** diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php index 397e5a826..63e2c0566 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php @@ -21,11 +21,8 @@ use Symfony\Component\Serializer\Annotation\Groups; * @ORM\Entity * * @ORM\Table(name="chill_person_social_issue") - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "social_issue": SocialIssue::class - * }) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['social_issue' => SocialIssue::class])] class SocialIssue { /** @@ -68,9 +65,8 @@ class SocialIssue /** * @ORM\Column(type="json") - * - * @Groups({"read"}) */ + #[Groups(['read'])] private array $title = []; public function __construct() diff --git a/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php b/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php index d2a7aba55..3a2a61cad 100644 --- a/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php +++ b/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php @@ -19,7 +19,7 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException; class PersonAltNameDataMapper implements DataMapperInterface { - public function mapDataToForms($viewData, iterable $forms): void + public function mapDataToForms($viewData, \Traversable $forms): void { if (null === $viewData) { return; @@ -43,7 +43,7 @@ class PersonAltNameDataMapper implements DataMapperInterface } } - public function mapFormsToData(iterable $forms, &$viewData): void + public function mapFormsToData(\Traversable $forms, &$viewData): void { $mapIndexToKey = []; diff --git a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php index 200a8fbac..2c6234eb0 100644 --- a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php +++ b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php @@ -62,12 +62,7 @@ final class SingleTaskController extends AbstractController private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, ) {} - /** - * @Route( - * "/{_locale}/task/single-task/{id}/delete", - * name="chill_task_single_task_delete" - * ) - */ + #[Route(path: '/{_locale}/task/single-task/{id}/delete', name: 'chill_task_single_task_delete')] public function deleteAction(Request $request, mixed $id) { $course = null; @@ -163,12 +158,7 @@ final class SingleTaskController extends AbstractController ); } - /** - * @Route( - * "/{_locale}/task/single-task/{id}/edit", - * name="chill_task_single_task_edit" - * ) - */ + #[Route(path: '/{_locale}/task/single-task/{id}/edit', name: 'chill_task_single_task_edit')] public function editAction( SingleTask $task, Request $request @@ -258,12 +248,8 @@ final class SingleTaskController extends AbstractController * - person_id * - hide_form (hide the form to filter the tasks) * - status: date state, amongst SingleTaskRepository::DATE_STATUSES, or 'closed'. - * - * @Route( - * "/{_locale}/task/single-task/list", - * name="chill_task_singletask_list" - * ) */ + #[Route(path: '/{_locale}/task/single-task/list', name: 'chill_task_singletask_list')] public function listAction( Request $request ) { @@ -316,11 +302,7 @@ final class SingleTaskController extends AbstractController ]); } - /** - * @Route( - * "/{_locale}/task/single-task/by-course/{id}", - * name="chill_task_singletask_by-course_list") - */ + #[Route(path: '/{_locale}/task/single-task/by-course/{id}', name: 'chill_task_singletask_by-course_list')] public function listCourseTasks( AccompanyingPeriod $course, FormFactoryInterface $formFactory, @@ -367,11 +349,7 @@ final class SingleTaskController extends AbstractController ); } - /** - * @Route( - * "/{_locale}/task/single-task/by-person/{id}", - * name="chill_task_singletask_by-person_list") - */ + #[Route(path: '/{_locale}/task/single-task/by-person/{id}', name: 'chill_task_singletask_by-person_list')] public function listPersonTasks( Person $person ): Response { @@ -418,17 +396,9 @@ final class SingleTaskController extends AbstractController /** * @return Response - * - * @Route( - * "/{_locale}/task/single-task/list/my", - * name="chill_task_singletask_my_tasks", - * defaults={"_format": "html"} - * ) - * @Route( - * "/api/1.0/task/single-task/list/my", - * defaults={"_format": "json"} - * ) */ + #[Route(path: '/{_locale}/task/single-task/list/my', name: 'chill_task_singletask_my_tasks', defaults: ['_format' => 'html'])] + #[Route(path: '/api/1.0/task/single-task/list/my', defaults: ['_format' => 'json'])] public function myTasksAction(string $_format, Request $request) { $this->denyAccessUnlessGranted('ROLE_USER'); @@ -484,12 +454,7 @@ final class SingleTaskController extends AbstractController } } - /** - * @Route( - * "/{_locale}/task/single-task/new", - * name="chill_task_single_task_new" - * ) - */ + #[Route(path: '/{_locale}/task/single-task/new', name: 'chill_task_single_task_new')] public function newAction(Request $request) { $user = $this->security->getUser(); @@ -600,12 +565,7 @@ final class SingleTaskController extends AbstractController }; } - /** - * @Route( - * "/{_locale}/task/single-task/{id}/show", - * name="chill_task_single_task_show" - * ) - */ + #[Route(path: '/{_locale}/task/single-task/{id}/show', name: 'chill_task_single_task_show')] public function showAction(SingleTask $task, Request $request) { $this->denyAccessUnlessGranted(TaskVoter::SHOW, $task); diff --git a/src/Bundle/ChillTaskBundle/Controller/TaskController.php b/src/Bundle/ChillTaskBundle/Controller/TaskController.php index 5ffc202de..8837dda05 100644 --- a/src/Bundle/ChillTaskBundle/Controller/TaskController.php +++ b/src/Bundle/ChillTaskBundle/Controller/TaskController.php @@ -36,17 +36,13 @@ class TaskController extends AbstractController /** * Apply a transition to a task. * - * @Route( - * "/{_locale}/task/transition/{kind}/{taskId}/{transition}", - * name="chill_task_task_transition" - * ) - * * @param string $kind * @param int $taskId * @param string $transition * * @return Response */ + #[Route(path: '/{_locale}/task/transition/{kind}/{taskId}/{transition}', name: 'chill_task_task_transition')] public function applyTransitionAction( $kind, $taskId, diff --git a/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php b/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php index f9118737f..d111ada3d 100644 --- a/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php +++ b/src/Bundle/ChillTaskBundle/Entity/AbstractTask.php @@ -25,20 +25,16 @@ use Symfony\Component\Validator\Constraints as Assert; * AbstractTask. * * @ORM\MappedSuperclass - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "single_task": SingleTask::class - * }) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['single_task' => SingleTask::class])] abstract class AbstractTask implements HasCenterInterface, HasScopeInterface { /** * @ORM\ManyToOne( * targetEntity="\Chill\MainBundle\Entity\User" * ) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?User $assignee = null; /** @@ -50,55 +46,47 @@ abstract class AbstractTask implements HasCenterInterface, HasScopeInterface /** * @ORM\Column(name="closed", type="boolean", options={ "default": false }) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $closed = false; /** * @ORM\ManyToOne(targetEntity="\Chill\PersonBundle\Entity\AccompanyingPeriod") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?AccompanyingPeriod $course = null; /** * @ORM\Column(name="current_states", type="json", options={"jsonb"=true, "default"="[]"}) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private array $currentStates = []; /** * @ORM\Column(name="description", type="text") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private string $description = ''; /** * @ORM\ManyToOne( * targetEntity="\Chill\PersonBundle\Entity\Person" * ) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?Person $person = null; /** * @ORM\Column(name="title", type="text") - * - * @Assert\NotBlank - * - * @Serializer\Groups({"read"}) */ + #[Assert\NotBlank] + #[Serializer\Groups(['read'])] private string $title = ''; /** * @ORM\Column(name="type", type="string", length=255) - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?string $type = null; public function getAssignee(): ?User diff --git a/src/Bundle/ChillTaskBundle/Entity/SingleTask.php b/src/Bundle/ChillTaskBundle/Entity/SingleTask.php index 5e8f8eb0b..dab5eb7e5 100644 --- a/src/Bundle/ChillTaskBundle/Entity/SingleTask.php +++ b/src/Bundle/ChillTaskBundle/Entity/SingleTask.php @@ -47,11 +47,9 @@ class SingleTask extends AbstractTask { /** * @ORM\Column(name="end_date", type="date", nullable=true) - * - * @Assert\Date - * - * @Serializer\Groups({"read"}) */ + #[Assert\Date] + #[Serializer\Groups(['read'])] private ?\DateTime $endDate = null; /** @@ -60,9 +58,8 @@ class SingleTask extends AbstractTask * @ORM\Id * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private ?int $id = null; /** @@ -75,20 +72,11 @@ class SingleTask extends AbstractTask /** * @ORM\Column(name="start_date", type="date", nullable=true) - * - * @Serializer\Groups({"read"}) - * - * @Assert\Date - * - * @Assert\Expression( - * "value === null or this.getEndDate() === null or value < this.getEndDate()", - * message="The start date must be before the end date" - * ) - * @Assert\Expression( - * "value === null or this.getWarningDate() === null or this.getWarningDate() > this.getStartDate()", - * message="The start date must be before warning date" - * ) */ + #[Serializer\Groups(['read'])] + #[Assert\Date] + #[Assert\Expression('value === null or this.getEndDate() === null or value < this.getEndDate()', message: 'The start date must be before the end date')] + #[Assert\Expression('value === null or this.getWarningDate() === null or this.getWarningDate() > this.getStartDate()', message: 'The start date must be before warning date')] private ?\DateTime $startDate = null; /** @@ -104,14 +92,9 @@ class SingleTask extends AbstractTask /** * @ORM\Column(name="warning_interval", type="dateinterval", nullable=true) - * - * @Serializer\Groups({"read"}) - * - * @Assert\Expression( - * "!(value != null and this.getEndDate() == null)", - * message="An end date is required if a warning interval is set" - * ) */ + #[Serializer\Groups(['read'])] + #[Assert\Expression('!(value != null and this.getEndDate() == null)', message: 'An end date is required if a warning interval is set')] private ?\DateInterval $warningInterval = null; public function __construct() @@ -164,9 +147,8 @@ class SingleTask extends AbstractTask * Return null if warningDate or endDate is null * * @return \DateTimeImmutable - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] public function getWarningDate() { if (null === $this->getWarningInterval()) { diff --git a/src/Bundle/ChillThirdPartyBundle/Controller/AdminController.php b/src/Bundle/ChillThirdPartyBundle/Controller/AdminController.php index 559310be6..85d50e93f 100644 --- a/src/Bundle/ChillThirdPartyBundle/Controller/AdminController.php +++ b/src/Bundle/ChillThirdPartyBundle/Controller/AdminController.php @@ -18,9 +18,8 @@ class AdminController extends AbstractController { /** * ThirdParty admin. - * - * @Route("/{_locale}/admin/thirdparty", name="chill_thirdparty_admin_index") */ + #[Route(path: '/{_locale}/admin/thirdparty', name: 'chill_thirdparty_admin_index')] public function indexAdminAction() { return $this->render('@ChillThirdParty/Admin/index.html.twig'); diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index 56a2e4dcd..ca910d854 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -92,11 +92,9 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * [fr] Sigle. * * @ORM\Column(name="acronym", type="string", length=64, nullable=true) - * - * @Assert\Length(min="2") - * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) */ + #[Assert\Length(min: 2)] + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private ?string $acronym = ''; /** @@ -112,10 +110,9 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * * @ORM\JoinColumn(nullable=true, onDelete="SET NULL") * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) - * * @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"}) */ + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private ?Address $address = null; /** @@ -136,10 +133,9 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * joinColumns={@ORM\JoinColumn(name="thirdparty_id", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="category_id", referencedColumnName="id")}) * - * @Groups({"docgen:read", "docgen:read:3party:parent"}) - * * @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"}) */ + #[Groups(['docgen:read', 'docgen:read:3party:parent'])] private Collection $categories; /** @@ -158,33 +154,29 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * cascade={"persist"}, orphanRemoval=true) * * @var Collection - * - * @Assert\Valid(traverse=true) */ + #[Assert\Valid(traverse: true)] private Collection $children; /** * @ORM\ManyToOne(targetEntity=Civility::class) * ORM\JoinColumn(name="civility", referencedColumnName="id", nullable=true) * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) - * * @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"}) */ + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private ?Civility $civility = null; /** * @ORM\Column(name="comment", type="text", nullable=true) - * - * @Groups({"read", "write"}) */ + #[Groups(['read', 'write'])] private ?string $comment = null; /** * @ORM\Column(name="contact_data_anonymous", type="boolean", options={"default": false}) - * - * @Groups({"read", "docgen:read", "docgen:read:3party:parent"}) */ + #[Groups(['read', 'docgen:read', 'docgen:read:3party:parent'])] private bool $contactDataAnonymous = false; /** @@ -201,18 +193,15 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin /** * @ORM\Column(name="email", type="string", length=255, nullable=true) - * - * @Assert\Email() - * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) */ + #[Assert\Email] + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private ?string $email = null; /** * @ORM\Column(name="firstname", type="text", options={"default": ""}) - * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) */ + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private ?string $firstname = ''; /** @@ -221,40 +210,32 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * @ORM\Id * * @ORM\GeneratedValue(strategy="AUTO") - * - * @Groups({"read", "docgen:read", "docgen:read:3party:parent"}) */ + #[Groups(['read', 'docgen:read', 'docgen:read:3party:parent'])] private ?int $id = null; /** * @ORM\Column(name="kind", type="string", length="20", options={"default": ""}) - * - * @Groups({"write", "docgen:read", "docgen:read:3party:parent"}) */ + #[Groups(['write', 'docgen:read', 'docgen:read:3party:parent'])] private string $kind = ''; /** * @ORM\Column(name="name", type="string", length=255) - * - * @Assert\Length(min="2") - * - * @Assert\NotNull - * - * @Assert\NotBlank - * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) */ + #[Assert\Length(min: 2)] + #[Assert\NotNull] + #[Assert\NotBlank] + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private string $name = ''; /** * [fr] Raison sociale. * * @ORM\Column(name="name_company", type="string", length=255, nullable=true) - * - * @Assert\Length(min="3") - * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) */ + #[Assert\Length(min: 3)] + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private ?string $nameCompany = ''; /** @@ -264,10 +245,9 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") * - * @Groups({"read", "write", "docgen:read"}) - * * @Context(normalizationContext={"groups": "docgen:read:3party:parent"}, groups={"docgen:read"}) */ + #[Groups(['read', 'write', 'docgen:read'])] private ?ThirdParty $parent = null; /** @@ -275,19 +255,17 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * * @ORM\Column(name="profession", type="text", nullable=false) * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) - * * @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"}) */ + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private string $profession = ''; /** * @ORM\Column(name="telephone", type="phone_number", nullable=true) * * @PhonenumberConstraint(type="any") - * - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) */ + #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] private ?PhoneNumber $telephone = null; /** @@ -546,9 +524,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin return $this->updatedBy; } - /** - * @Groups({"read", "docgen:read", "docgen:read:3party:parent"}) - */ + #[Groups(['read', 'docgen:read', 'docgen:read:3party:parent'])] public function isChild(): bool { return null !== $this->parent; diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyCategory.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyCategory.php index 7bd8f9f7b..8d29ab620 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyCategory.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyCategory.php @@ -33,16 +33,14 @@ class ThirdPartyCategory * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private ?int $id = null; /** * @ORM\Column(type="json") - * - * @Serializer\Groups({"docgen:read"}) */ + #[Serializer\Groups(['docgen:read'])] private array $name = []; public function getActive(): ?bool diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php index 8994543c2..87d9d046c 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php @@ -19,17 +19,14 @@ use Symfony\Component\Serializer\Annotation as Serializer; * @ORM\Table(name="chill_3party.party_profession") * * @ORM\Entity(repositoryClass=ThirdPartyProfessionRepository::class) - * - * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ - * "third_party_profession": ThirdPartyProfession::class}) */ +#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['third_party_profession' => ThirdPartyProfession::class])] class ThirdPartyProfession { /** * @ORM\Column(type="boolean") - * - * @Serializer\Groups({"read"}) */ + #[Serializer\Groups(['read'])] private bool $active = true; /** @@ -38,16 +35,14 @@ class ThirdPartyProfession * @ORM\GeneratedValue * * @ORM\Column(type="integer") - * - * @Serializer\Groups({"docgen:read", "read", "write"}) */ + #[Serializer\Groups(['docgen:read', 'read', 'write'])] private ?int $id = null; /** * @ORM\Column(type="json") - * - * @Serializer\Groups({"docgen:read", "read"}) */ + #[Serializer\Groups(['docgen:read', 'read'])] private array $name = []; public function getActive(): ?bool