From 3a738179f2bf62075d2614c53367b15980ea3277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 12 Mar 2025 17:41:59 +0100 Subject: [PATCH] use correct repository for filters and aggregators --- .../Filter/ACPFilters/ActivityTypeFilter.php | 2 +- .../Export/Filter/ActivityPresenceFilter.php | 4 +++- .../Export/Filter/ActivityTypeFilter.php | 2 +- .../Export/Filter/ActivityUsersFilter.php | 7 ++++--- .../Export/Filter/ByCreatorFilter.php | 5 +++-- .../Export/Filter/CreatorJobFilter.php | 2 +- .../Export/Filter/CreatorScopeFilter.php | 2 +- .../Export/Filter/LocationFilter.php | 11 +++++++++-- .../Filter/PersonFilters/ActivityReasonFilter.php | 2 +- .../Export/Filter/UserFilter.php | 7 ++++--- .../Export/Filter/UsersJobFilter.php | 2 +- .../Export/Filter/UsersScopeFilter.php | 2 +- .../ActivityPresenceRepositoryInterface.php | 3 ++- .../src/Export/Filter/ByActivityTypeFilter.php | 6 +++--- .../src/Export/Filter/ByLocationFilter.php | 4 +++- .../src/Export/Filter/ByUserFilter.php | 7 ++++--- .../src/Export/Filter/ByUserJobFilter.php | 2 +- .../src/Export/Filter/ByUserScopeFilter.php | 2 +- .../Export/Filter/AgentFilter.php | 7 ++++--- .../Export/Filter/JobFilter.php | 2 +- .../Export/Filter/ScopeFilter.php | 2 +- .../Export/Filter/EventTypeFilter.php | 2 +- .../ChillEventBundle/Export/Filter/RoleFilter.php | 2 +- .../GeographicalUnitStatAggregator.php | 8 ++++++-- .../GeographicalUnitAggregator.php | 10 +++++++--- .../AdministrativeLocationFilter.php | 8 +++++--- .../ClosingMotiveFilter.php | 7 ++++--- .../AccompanyingCourseFilters/CreatorFilter.php | 10 ++++++++-- .../CreatorJobFilter.php | 8 ++++---- .../EvaluationFilter.php | 6 +++--- .../JobWorkingOnCourseFilter.php | 2 +- .../AccompanyingCourseFilters/OriginFilter.php | 7 ++++--- .../AccompanyingCourseFilters/ReferrerFilter.php | 7 ++++--- .../ReferrerFilterBetweenDates.php | 4 +++- .../ScopeWorkingOnCourseFilter.php | 2 +- .../AccompanyingCourseFilters/UserJobFilter.php | 7 +++++-- .../AccompanyingCourseFilters/UserScopeFilter.php | 2 +- .../UserWorkingOnCourseFilter.php | 4 +++- .../EvaluationFilters/EvaluationTypeFilter.php | 2 +- .../Filter/HouseholdFilters/CompositionFilter.php | 4 +++- .../ByHouseholdCompositionFilter.php | 2 +- .../Filter/PersonFilters/MaritalStatusFilter.php | 7 ++++--- .../ResidentialAddressAtThirdpartyFilter.php | 11 ++++++++--- .../Filter/SocialWorkFilters/CreatorFilter.php | 10 ++++++++-- .../Filter/SocialWorkFilters/CreatorJobFilter.php | 8 ++++---- .../SocialWorkFilters/CreatorScopeFilter.php | 2 +- .../Export/Filter/SocialWorkFilters/JobFilter.php | 12 +++++------- .../Filter/SocialWorkFilters/ReferrerFilter.php | 5 +++-- .../Filter/SocialWorkFilters/ScopeFilter.php | 9 ++++----- .../AccompanyingPeriod/OriginRepository.php | 15 ++++++++------- .../MaritalStatusRepositoryInterface.php | 3 ++- 51 files changed, 163 insertions(+), 106 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php index 40c2e2d08..d9b95ebd4 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php @@ -105,7 +105,7 @@ final readonly class ActivityTypeFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['accepted_activitytypes' => $this->denormalizeDoctrineEntity($formData['accepted_activitytypes'], $this->someRepository), 'date_after' => \Chill\MainBundle\Service\RollingDate\RollingDate::fromNormalized($formData['date_after']), 'date_before' => \Chill\MainBundle\Service\RollingDate\RollingDate::fromNormalized($formData['date_before'])]; + return ['accepted_activitytypes' => $this->denormalizeDoctrineEntity($formData['accepted_activitytypes'], $this->activityTypeRepository), 'date_after' => \Chill\MainBundle\Service\RollingDate\RollingDate::fromNormalized($formData['date_after']), 'date_before' => \Chill\MainBundle\Service\RollingDate\RollingDate::fromNormalized($formData['date_before'])]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityPresenceFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityPresenceFilter.php index de5ae96a0..4e3d5257a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityPresenceFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityPresenceFilter.php @@ -13,6 +13,7 @@ namespace Chill\ActivityBundle\Export\Filter; use Chill\ActivityBundle\Entity\ActivityPresence; use Chill\ActivityBundle\Export\Declarations; +use Chill\ActivityBundle\Repository\ActivityPresenceRepositoryInterface; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Doctrine\Common\Collections\Collection; @@ -28,6 +29,7 @@ final readonly class ActivityPresenceFilter implements FilterInterface public function __construct( private TranslatableStringHelperInterface $translatableStringHelper, private TranslatorInterface $translator, + private ActivityPresenceRepositoryInterface $activityPresenceRepository, ) {} public function getTitle() @@ -59,7 +61,7 @@ final readonly class ActivityPresenceFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['presences' => $this->denormalizeDoctrineEntity($formData['presences'], $this->someRepository)]; + return ['presences' => $this->denormalizeDoctrineEntity($formData['presences'], $this->activityPresenceRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php index 303c1cba7..dceb6c4a8 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php @@ -84,7 +84,7 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['types' => $this->denormalizeDoctrineEntity($formData['types'], $this->someRepository)]; + return ['types' => $this->denormalizeDoctrineEntity($formData['types'], $this->activityTypeRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php index 9f6712715..d2474751a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php @@ -14,15 +14,16 @@ namespace Chill\ActivityBundle\Export\Filter; use Chill\ActivityBundle\Export\Declarations; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickUserDynamicType; +use Chill\MainBundle\Repository\UserRepositoryInterface; use Chill\MainBundle\Templating\Entity\UserRender; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; -class ActivityUsersFilter implements FilterInterface +final readonly class ActivityUsersFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; - public function __construct(private readonly UserRender $userRender) {} + public function __construct(private UserRender $userRender, private UserRepositoryInterface $userRepository) {} public function addRole(): ?string { @@ -66,7 +67,7 @@ class ActivityUsersFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['accepted_users' => $this->denormalizeDoctrineEntity($formData['accepted_users'], $this->someRepository)]; + return ['accepted_users' => $this->denormalizeDoctrineEntity($formData['accepted_users'], $this->userRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ByCreatorFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ByCreatorFilter.php index 1e443e34c..40cfec067 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ByCreatorFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ByCreatorFilter.php @@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Export\Filter; use Chill\ActivityBundle\Export\Declarations; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickUserDynamicType; +use Chill\MainBundle\Repository\UserRepositoryInterface; use Chill\MainBundle\Templating\Entity\UserRender; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -22,7 +23,7 @@ class ByCreatorFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; - public function __construct(private readonly UserRender $userRender) {} + public function __construct(private readonly UserRender $userRender, private readonly UserRepositoryInterface $userRepository) {} public function addRole(): ?string { @@ -62,7 +63,7 @@ class ByCreatorFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['accepted_users' => $this->denormalizeDoctrineEntity($formData['accepted_users'], $this->someRepository)]; + return ['accepted_users' => $this->denormalizeDoctrineEntity($formData['accepted_users'], $this->userRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/CreatorJobFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/CreatorJobFilter.php index a0e85fb26..a42c0a0f6 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/CreatorJobFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/CreatorJobFilter.php @@ -103,7 +103,7 @@ final readonly class CreatorJobFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['jobs' => $this->denormalizeDoctrineEntity($formData['jobs'], $this->someRepository)]; + return ['jobs' => $this->denormalizeDoctrineEntity($formData['jobs'], $this->userJobRepository)]; } public function describeAction($data, $format = 'string'): array diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/CreatorScopeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/CreatorScopeFilter.php index 7d2bbc3da..2209eb0fe 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/CreatorScopeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/CreatorScopeFilter.php @@ -99,7 +99,7 @@ class CreatorScopeFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['scopes' => $this->denormalizeDoctrineEntity($formData['scopes'], $this->someRepository)]; + return ['scopes' => $this->denormalizeDoctrineEntity($formData['scopes'], $this->scopeRepository)]; } public function describeAction($data, $format = 'string'): array diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/LocationFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/LocationFilter.php index 786f9ddcd..41e33442d 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/LocationFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/LocationFilter.php @@ -14,13 +14,20 @@ namespace Chill\ActivityBundle\Export\Filter; use Chill\ActivityBundle\Export\Declarations; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickUserLocationType; +use Chill\MainBundle\Repository\LocationRepository; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; -class LocationFilter implements FilterInterface +final readonly class LocationFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; + public function __construct( + private LocationRepository $locationRepository, + ) + { + } + public function addRole(): ?string { return null; @@ -60,7 +67,7 @@ class LocationFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['accepted_location' => $this->denormalizeDoctrineEntity($formData['accepted_location'], $this->someRepository)]; + return ['accepted_location' => $this->denormalizeDoctrineEntity($formData['accepted_location'], $this->locationRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php index e9f18ae01..abba75822 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php @@ -84,7 +84,7 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['reasons' => $this->denormalizeDoctrineEntity($formData['reasons'], $this->someRepository)]; + return ['reasons' => $this->denormalizeDoctrineEntity($formData['reasons'], $this->activityReasonRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/UserFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/UserFilter.php index 6fd807846..2ea65c787 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/UserFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/UserFilter.php @@ -14,16 +14,17 @@ namespace Chill\ActivityBundle\Export\Filter; use Chill\ActivityBundle\Export\Declarations; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickUserDynamicType; +use Chill\MainBundle\Repository\UserRepositoryInterface; use Chill\MainBundle\Templating\Entity\UserRender; use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; -class UserFilter implements FilterInterface +final readonly class UserFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; - public function __construct(private readonly UserRender $userRender) {} + public function __construct(private UserRender $userRender, private UserRepositoryInterface $userRepository) {} public function addRole(): ?string { @@ -71,7 +72,7 @@ class UserFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['accepted_users' => $this->denormalizeDoctrineEntity($formData['accepted_users'], $this->someRepository)]; + return ['accepted_users' => $this->denormalizeDoctrineEntity($formData['accepted_users'], $this->userRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php index c99a7ea16..5c62daec1 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php @@ -90,7 +90,7 @@ class UsersJobFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['jobs' => $this->denormalizeDoctrineEntity($formData['jobs'], $this->someRepository)]; + return ['jobs' => $this->denormalizeDoctrineEntity($formData['jobs'], $this->userJobRepository)]; } public function describeAction($data, $format = 'string') diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php index eebf92a40..86556f462 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php @@ -90,7 +90,7 @@ class UsersScopeFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['scopes' => $this->denormalizeDoctrineEntity($formData['scopes'], $this->someRepository)]; + return ['scopes' => $this->denormalizeDoctrineEntity($formData['scopes'], $this->scopeRepository)]; } public function describeAction($data, $format = 'string'): array diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityPresenceRepositoryInterface.php b/src/Bundle/ChillActivityBundle/Repository/ActivityPresenceRepositoryInterface.php index 228d70856..0efc8d056 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityPresenceRepositoryInterface.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityPresenceRepositoryInterface.php @@ -12,8 +12,9 @@ declare(strict_types=1); namespace Chill\ActivityBundle\Repository; use Chill\ActivityBundle\Entity\ActivityPresence; +use Doctrine\Persistence\ObjectRepository; -interface ActivityPresenceRepositoryInterface +interface ActivityPresenceRepositoryInterface extends ObjectRepository { public function find($id): ?ActivityPresence; diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php index 33057249c..cc127d4e1 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php @@ -27,9 +27,9 @@ class ByActivityTypeFilter implements FilterInterface use \Chill\MainBundle\Export\ExportDataNormalizerTrait; public function __construct( - private readonly CategoryRender $categoryRender, + private readonly CategoryRender $categoryRender, private readonly TranslatableStringHelperInterface $translatableStringHelper, - private readonly AsideActivityCategoryRepository $asideActivityTypeRepository, + private readonly AsideActivityCategoryRepository $asideActivityTypeRepository, private readonly AsideActivityCategoryRepository $asideActivityCategoryRepository, ) {} public function addRole(): ?string @@ -82,7 +82,7 @@ class ByActivityTypeFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['types' => $this->denormalizeDoctrineEntity($formData['types'], $this->someRepository)]; + return ['types' => $this->denormalizeDoctrineEntity($formData['types'], $this->asideActivityCategoryRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByLocationFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByLocationFilter.php index 3569ed1d4..6bc98d64d 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByLocationFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByLocationFilter.php @@ -16,6 +16,7 @@ use Chill\MainBundle\Entity\Location; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickUserLocationType; +use Chill\MainBundle\Repository\LocationRepository; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -27,6 +28,7 @@ final readonly class ByLocationFilter implements FilterInterface public function __construct( private Security $security, + private LocationRepository $locationRepository, ) {} public function getTitle(): string @@ -52,7 +54,7 @@ final readonly class ByLocationFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['locations' => $this->denormalizeDoctrineEntity($formData['locations'], $this->someRepository)]; + return ['locations' => $this->denormalizeDoctrineEntity($formData['locations'], $this->locationRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php index 73d690752..d0c2a6f45 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php @@ -14,15 +14,16 @@ namespace Chill\AsideActivityBundle\Export\Filter; use Chill\AsideActivityBundle\Export\Declarations; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickUserDynamicType; +use Chill\MainBundle\Repository\UserRepository; use Chill\MainBundle\Templating\Entity\UserRender; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; -class ByUserFilter implements FilterInterface +final readonly class ByUserFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; - public function __construct(private readonly UserRender $userRender) {} + public function __construct(private UserRender $userRender, private UserRepository $userRepository) {} public function addRole(): ?string { @@ -63,7 +64,7 @@ class ByUserFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['accepted_users' => $this->denormalizeDoctrineEntity($formData['accepted_users'], $this->someRepository)]; + return ['accepted_users' => $this->denormalizeDoctrineEntity($formData['accepted_users'], $this->userRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php index 2042de6ce..21774c880 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php @@ -90,7 +90,7 @@ class ByUserJobFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['jobs' => $this->denormalizeDoctrineEntity($formData['jobs'], $this->someRepository)]; + return ['jobs' => $this->denormalizeDoctrineEntity($formData['jobs'], $this->userJobRepository)]; } public function describeAction($data, $format = 'string'): array diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php index 71cb2e8ea..72f5f6d4b 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php @@ -90,7 +90,7 @@ class ByUserScopeFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['scopes' => $this->denormalizeDoctrineEntity($formData['scopes'], $this->someRepository)]; + return ['scopes' => $this->denormalizeDoctrineEntity($formData['scopes'], $this->scopeRepository)]; } public function describeAction($data, $format = 'string') diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php index edbe4eebc..74ada0db9 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php @@ -14,17 +14,18 @@ namespace Chill\CalendarBundle\Export\Filter; use Chill\CalendarBundle\Export\Declarations; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Export\FilterInterface; +use Chill\MainBundle\Repository\UserRepositoryInterface; use Chill\MainBundle\Templating\Entity\UserRender; use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; -class AgentFilter implements FilterInterface +final readonly class AgentFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; - public function __construct(private readonly UserRender $userRender) {} + public function __construct(private UserRender $userRender, private UserRepositoryInterface $userRepository) {} public function addRole(): ?string { @@ -73,7 +74,7 @@ class AgentFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['accepted_agents' => $this->denormalizeDoctrineEntity($formData['accepted_agents'], $this->someRepository)]; + return ['accepted_agents' => $this->denormalizeDoctrineEntity($formData['accepted_agents'], $this->userRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php index 1967faefc..a7e19ce99 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php @@ -97,7 +97,7 @@ final readonly class JobFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['job' => $this->denormalizeDoctrineEntity($formData['job'], $this->someRepository)]; + return ['job' => $this->denormalizeDoctrineEntity($formData['job'], $this->userJobRepository)]; } public function describeAction($data, $format = 'string'): array diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php index 954aa752e..70e51aeb3 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php @@ -99,7 +99,7 @@ class ScopeFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['scope' => $this->denormalizeDoctrineEntity($formData['scope'], $this->someRepository)]; + return ['scope' => $this->denormalizeDoctrineEntity($formData['scope'], $this->scopeRepository)]; } public function describeAction($data, $format = 'string'): array diff --git a/src/Bundle/ChillEventBundle/Export/Filter/EventTypeFilter.php b/src/Bundle/ChillEventBundle/Export/Filter/EventTypeFilter.php index e9c7d7811..f0473020a 100644 --- a/src/Bundle/ChillEventBundle/Export/Filter/EventTypeFilter.php +++ b/src/Bundle/ChillEventBundle/Export/Filter/EventTypeFilter.php @@ -75,7 +75,7 @@ class EventTypeFilter implements ExportElementValidatedInterface, FilterInterfac public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['types' => $this->denormalizeDoctrineEntity($formData['types'], $this->someRepository)]; + return ['types' => $this->denormalizeDoctrineEntity($formData['types'], $this->eventTypeRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillEventBundle/Export/Filter/RoleFilter.php b/src/Bundle/ChillEventBundle/Export/Filter/RoleFilter.php index 2c3161b46..ea64034dd 100644 --- a/src/Bundle/ChillEventBundle/Export/Filter/RoleFilter.php +++ b/src/Bundle/ChillEventBundle/Export/Filter/RoleFilter.php @@ -75,7 +75,7 @@ class RoleFilter implements ExportElementValidatedInterface, FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['part_roles' => $this->denormalizeDoctrineEntity($formData['part_roles'], $this->someRepository)]; + return ['part_roles' => $this->denormalizeDoctrineEntity($formData['part_roles'], $this->roleRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php index f2d752969..c3cbf4043 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php @@ -30,7 +30,11 @@ final readonly class GeographicalUnitStatAggregator implements AggregatorInterfa { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; - public function __construct(private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter) {} + public function __construct( + private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, + private TranslatableStringHelperInterface $translatableStringHelper, + private RollingDateConverterInterface $rollingDateConverter, + ) {} public function addRole(): ?string { @@ -137,7 +141,7 @@ final readonly class GeographicalUnitStatAggregator implements AggregatorInterfa public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['date_calc' => RollingDate::fromNormalized($formData['date_calc']), 'level' => $this->denormalizeDoctrineEntity($formData['level'], $this->someRepository)]; + return ['date_calc' => RollingDate::fromNormalized($formData['date_calc']), 'level' => $this->denormalizeDoctrineEntity($formData['level'], $this->geographicalUnitLayerRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php index 523c4576d..e0e5fc26e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GeographicalUnitAggregator.php @@ -24,11 +24,15 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; -class GeographicalUnitAggregator implements AggregatorInterface +final readonly class GeographicalUnitAggregator implements AggregatorInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; - public function __construct(private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct( + private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, + private TranslatableStringHelperInterface $translatableStringHelper, + private RollingDateConverterInterface $rollingDateConverter, + ) {} public function addRole(): ?string { @@ -110,7 +114,7 @@ class GeographicalUnitAggregator implements AggregatorInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['date_calc' => RollingDate::fromNormalized($formData['date_calc']), 'level' => $this->denormalizeDoctrineEntity($formData['level'], $this->someRepository)]; + return ['date_calc' => RollingDate::fromNormalized($formData['date_calc']), 'level' => $this->denormalizeDoctrineEntity($formData['level'], $this->geographicalUnitLayerRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php index 147735f32..616d5c22e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php @@ -13,16 +13,18 @@ namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickUserLocationType; +use Chill\MainBundle\Repository\LocationRepository; +use Chill\MainBundle\Repository\LocationTypeRepository; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; -class AdministrativeLocationFilter implements FilterInterface +final readonly class AdministrativeLocationFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private TranslatableStringHelper $translatableStringHelper, private LocationTypeRepository $locationTypeRepository) {} public function addRole(): ?string { @@ -62,7 +64,7 @@ class AdministrativeLocationFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['accepted_locations' => $this->denormalizeDoctrineEntity($formData['accepted_locations'], $this->someRepository)]; + return ['accepted_locations' => $this->denormalizeDoctrineEntity($formData['accepted_locations'], $this->locationTypeRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php index 8345feaff..12141e60a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php @@ -15,16 +15,17 @@ use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive; use Chill\PersonBundle\Export\Declarations; +use Chill\PersonBundle\Repository\AccompanyingPeriod\ClosingMotiveRepositoryInterface; use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; -class ClosingMotiveFilter implements FilterInterface +final readonly class ClosingMotiveFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private TranslatableStringHelper $translatableStringHelper, private ClosingMotiveRepositoryInterface $closingMotiveRepository) {} public function addRole(): ?string { @@ -73,7 +74,7 @@ class ClosingMotiveFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['accepted_closingmotives' => $this->denormalizeDoctrineEntity($formData['accepted_closingmotives'], $this->someRepository)]; + return ['accepted_closingmotives' => $this->denormalizeDoctrineEntity($formData['accepted_closingmotives'], $this->closingMotiveRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorFilter.php index 0f362c2aa..3b5934c92 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorFilter.php @@ -14,15 +14,21 @@ namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickUserDynamicType; +use Chill\MainBundle\Repository\UserRepositoryInterface; use Chill\PersonBundle\Export\Declarations; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; -class CreatorFilter implements FilterInterface +final readonly class CreatorFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; + function __construct(private readonly UserRepositoryInterface $userRepository) + { + + } + public function addRole(): ?string { return null; @@ -65,7 +71,7 @@ class CreatorFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['accepted_creators' => $this->denormalizeDoctrineEntity($formData['accepted_creators'], $this->someRepository)]; + return ['accepted_creators' => $this->denormalizeDoctrineEntity($formData['accepted_creators'], $this->userRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php index 3ffd5079a..93055ae55 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php @@ -22,14 +22,14 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; -class CreatorJobFilter implements FilterInterface +final readonly class CreatorJobFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; private const PREFIX = 'acp_filter_creator_job'; public function __construct( - private readonly TranslatableStringHelper $translatableStringHelper, - private readonly UserJobRepositoryInterface $userJobRepository, + private TranslatableStringHelper $translatableStringHelper, + private UserJobRepositoryInterface $userJobRepository, ) {} public function addRole(): ?string @@ -111,7 +111,7 @@ class CreatorJobFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['creator_job' => $this->denormalizeDoctrineEntity($formData['creator_job'], $this->someRepository)]; + return ['creator_job' => $this->denormalizeDoctrineEntity($formData['creator_job'], $this->userJobRepository)]; } public function describeAction($data, $format = 'string'): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php index 4ee9ccd7d..f504857ce 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php @@ -20,11 +20,11 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; -class EvaluationFilter implements FilterInterface +final readonly class EvaluationFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; - public function __construct(private readonly EvaluationRepositoryInterface $evaluationRepository, private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private EvaluationRepositoryInterface $evaluationRepository, private TranslatableStringHelper $translatableStringHelper) {} public function addRole(): ?string { @@ -79,7 +79,7 @@ class EvaluationFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['accepted_evaluations' => $this->denormalizeDoctrineEntity($formData['accepted_evaluations'], $this->someRepository)]; + return ['accepted_evaluations' => $this->denormalizeDoctrineEntity($formData['accepted_evaluations'], $this->evaluationRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/JobWorkingOnCourseFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/JobWorkingOnCourseFilter.php index 8e38a2e0c..72007eb98 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/JobWorkingOnCourseFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/JobWorkingOnCourseFilter.php @@ -118,7 +118,7 @@ readonly class JobWorkingOnCourseFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['jobs' => $this->denormalizeDoctrineEntity($formData['jobs'], $this->someRepository), 'start_date' => RollingDate::fromNormalized($formData['start_date']), 'end_date' => RollingDate::fromNormalized($formData['end_date'])]; + return ['jobs' => $this->denormalizeDoctrineEntity($formData['jobs'], $this->userJobRepository), 'start_date' => RollingDate::fromNormalized($formData['start_date']), 'end_date' => RollingDate::fromNormalized($formData['end_date'])]; } public function describeAction($data, $format = 'string'): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php index 14d159445..79dc50faa 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php @@ -15,16 +15,17 @@ use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin; use Chill\PersonBundle\Export\Declarations; +use Chill\PersonBundle\Repository\AccompanyingPeriod\OriginRepository; use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; -class OriginFilter implements FilterInterface +final readonly class OriginFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private TranslatableStringHelper $translatableStringHelper, private OriginRepository $originRepository) {} public function addRole(): ?string { @@ -73,7 +74,7 @@ class OriginFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['accepted_origins' => $this->denormalizeDoctrineEntity($formData['accepted_origins'], $this->someRepository)]; + return ['accepted_origins' => $this->denormalizeDoctrineEntity($formData['accepted_origins'], $this->originRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php index a35d13154..36b8be2ae 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php @@ -14,13 +14,14 @@ namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickRollingDateType; use Chill\MainBundle\Form\Type\PickUserDynamicType; +use Chill\MainBundle\Repository\UserRepositoryInterface; use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; -class ReferrerFilter implements FilterInterface +final readonly class ReferrerFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; private const A = 'acp_referrer_filter_uhistory'; @@ -29,7 +30,7 @@ class ReferrerFilter implements FilterInterface private const PU = 'acp_referrer_filter_users'; - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private RollingDateConverterInterface $rollingDateConverter, private UserRepositoryInterface $userRepository) {} public function addRole(): ?string { @@ -88,7 +89,7 @@ class ReferrerFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['accepted_referrers' => $this->denormalizeDoctrineEntity($formData['accepted_referrers'], $this->someRepository), 'date_calc' => RollingDate::fromNormalized($formData['date_calc'])]; + return ['accepted_referrers' => $this->denormalizeDoctrineEntity($formData['accepted_referrers'], $this->userRepository), 'date_calc' => RollingDate::fromNormalized($formData['date_calc'])]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDates.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDates.php index 634a5e408..d5fc3ccfa 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDates.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDates.php @@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickRollingDateType; use Chill\MainBundle\Form\Type\PickUserDynamicType; +use Chill\MainBundle\Repository\UserRepository; use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\MainBundle\Templating\Entity\UserRender; @@ -43,6 +44,7 @@ final readonly class ReferrerFilterBetweenDates implements FilterInterface public function __construct( private RollingDateConverterInterface $rollingDateConverter, private UserRender $userRender, + private UserRepository $userRepository, ) {} public function addRole(): ?string @@ -103,7 +105,7 @@ final readonly class ReferrerFilterBetweenDates implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['accepted_referrers' => $this->denormalizeDoctrineEntity($formData['accepted_referrers'], $this->someRepository), 'start_date' => RollingDate::fromNormalized($formData['start_date']), 'end_date' => RollingDate::fromNormalized($formData['end_date'])]; + return ['accepted_referrers' => $this->denormalizeDoctrineEntity($formData['accepted_referrers'], $this->userRepository), 'start_date' => RollingDate::fromNormalized($formData['start_date']), 'end_date' => RollingDate::fromNormalized($formData['end_date'])]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ScopeWorkingOnCourseFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ScopeWorkingOnCourseFilter.php index 3a1814ff3..b778fbaed 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ScopeWorkingOnCourseFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ScopeWorkingOnCourseFilter.php @@ -113,7 +113,7 @@ readonly class ScopeWorkingOnCourseFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['scopes' => $this->denormalizeDoctrineEntity($formData['scopes'], $this->someRepository), 'start_date' => RollingDate::fromNormalized($formData['start_date']), 'end_date' => RollingDate::fromNormalized($formData['end_date'])]; + return ['scopes' => $this->denormalizeDoctrineEntity($formData['scopes'], $this->scopeRepository), 'start_date' => RollingDate::fromNormalized($formData['start_date']), 'end_date' => RollingDate::fromNormalized($formData['end_date'])]; } public function describeAction($data, $format = 'string'): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php index 9428c3642..3bdf68b19 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php @@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Entity\User\UserJobHistory; use Chill\MainBundle\Entity\UserJob; use Chill\MainBundle\Export\DataTransformerInterface; +use Chill\MainBundle\Export\ExportDataNormalizerTrait; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickRollingDateType; use Chill\MainBundle\Repository\UserJobRepositoryInterface; @@ -30,6 +31,8 @@ use Symfony\Component\Form\FormBuilderInterface; final readonly class UserJobFilter implements FilterInterface, DataTransformerInterface { + use ExportDataNormalizerTrait; + private const PREFIX = 'acp_filter_user_job'; public function __construct( @@ -129,7 +132,7 @@ final readonly class UserJobFilter implements FilterInterface, DataTransformerIn public function normalizeFormData(array $formData): array { return [ - 'jobs' => array_map(static fn (UserJob $job) => $job->getId(), (array) $formData['jobs']), + 'jobs' => $this->normalizeDoctrineEntity($formData['jobs']), 'start_date' => $formData['start_date']->normalize(), 'end_date' => $formData['end_date']->normalize(), ]; @@ -138,7 +141,7 @@ final readonly class UserJobFilter implements FilterInterface, DataTransformerIn public function denormalizeFormData(array $formData, int $fromVersion): array { return [ - 'jobs' => new ArrayCollection(array_filter(array_map(static fn (int $id) => $this->userJobRepository->find($id), $formData['jobs']), fn (?UserJob $job) => null !== $job)), + 'jobs' => $this->denormalizeDoctrineEntity($formData['jobs'], $this->userJobRepository), 'start_date' => RollingDate::fromNormalized($formData['start_date']), 'end_date' => RollingDate::fromNormalized($formData['end_date']), ]; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php index da3b965cf..e7f144a30 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserScopeFilter.php @@ -109,7 +109,7 @@ final readonly class UserScopeFilter implements FilterInterface, DataTransformer public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['scopes' => $this->denormalizeDoctrineEntity($formData['scopes'], $this->someRepository), 'start_date' => RollingDate::fromNormalized($formData['start_date']), 'end_date' => RollingDate::fromNormalized($formData['end_date'])]; + return ['scopes' => $this->denormalizeDoctrineEntity($formData['scopes'], $this->scopeRepository), 'start_date' => RollingDate::fromNormalized($formData['start_date']), 'end_date' => RollingDate::fromNormalized($formData['end_date'])]; } public function describeAction($data, $format = 'string') diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserWorkingOnCourseFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserWorkingOnCourseFilter.php index e383e7737..05fe4dfdc 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserWorkingOnCourseFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserWorkingOnCourseFilter.php @@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\User; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickRollingDateType; use Chill\MainBundle\Form\Type\PickUserDynamicType; +use Chill\MainBundle\Repository\UserRepositoryInterface; use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\MainBundle\Templating\Entity\UserRender; @@ -36,6 +37,7 @@ final readonly class UserWorkingOnCourseFilter implements FilterInterface public function __construct( private UserRender $userRender, private RollingDateConverterInterface $rollingDateConverter, + private UserRepositoryInterface $userRepository, ) {} public function buildForm(FormBuilderInterface $builder): void @@ -65,7 +67,7 @@ final readonly class UserWorkingOnCourseFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['users' => $this->denormalizeDoctrineEntity($formData['users'], $this->someRepository), 'start_date' => RollingDate::fromNormalized($formData['start_date']), 'end_date' => RollingDate::fromNormalized($formData['end_date'])]; + return ['users' => $this->denormalizeDoctrineEntity($formData['users'], $this->userRepository), 'start_date' => RollingDate::fromNormalized($formData['start_date']), 'end_date' => RollingDate::fromNormalized($formData['end_date'])]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php index 5db19bdc0..d34b1439e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php @@ -72,7 +72,7 @@ final readonly class EvaluationTypeFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['accepted_evaluationtype' => $this->denormalizeDoctrineEntity($formData['accepted_evaluationtype'], $this->someRepository)]; + return ['accepted_evaluationtype' => $this->denormalizeDoctrineEntity($formData['accepted_evaluationtype'], $this->evaluationRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php index 01cba5b85..de700660f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php @@ -18,6 +18,7 @@ use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\Household\HouseholdCompositionType; use Chill\PersonBundle\Export\Declarations; +use Chill\PersonBundle\Repository\Household\HouseholdCompositionTypeRepositoryInterface; use Doctrine\ORM\Query\Expr; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; @@ -30,6 +31,7 @@ readonly class CompositionFilter implements FilterInterface public function __construct( private TranslatableStringHelper $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter, + private HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, ) {} public function addRole(): ?string @@ -92,7 +94,7 @@ readonly class CompositionFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['accepted_composition' => $this->denormalizeDoctrineEntity($formData['accepted_composition'], $this->someRepository), 'on_date' => RollingDate::fromNormalized($formData['on_date'])]; + return ['accepted_composition' => $this->denormalizeDoctrineEntity($formData['accepted_composition'], $this->householdCompositionTypeRepository), 'on_date' => RollingDate::fromNormalized($formData['on_date'])]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php index 6a5cdb5a8..8f6e1efc1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php @@ -90,7 +90,7 @@ class ByHouseholdCompositionFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['compositions' => $this->denormalizeDoctrineEntity($formData['compositions'], $this->someRepository), 'calc_date' => RollingDate::fromNormalized($formData['calc_date'])]; + return ['compositions' => $this->denormalizeDoctrineEntity($formData['compositions'], $this->householdCompositionTypeRepository), 'calc_date' => RollingDate::fromNormalized($formData['calc_date'])]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php index c77a16373..6d1a12934 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php @@ -15,13 +15,14 @@ use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\MaritalStatus; use Chill\PersonBundle\Export\Declarations; +use Chill\PersonBundle\Repository\MaritalStatusRepositoryInterface; use Symfony\Bridge\Doctrine\Form\Type\EntityType; -class MaritalStatusFilter implements FilterInterface +final readonly class MaritalStatusFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; - public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct(private TranslatableStringHelper $translatableStringHelper, private MaritalStatusRepositoryInterface $maritalStatusRepository) {} public function addRole(): ?string { @@ -65,7 +66,7 @@ class MaritalStatusFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['maritalStatus' => $this->denormalizeDoctrineEntity($formData['maritalStatus'], $this->someRepository)]; + return ['maritalStatus' => $this->denormalizeDoctrineEntity($formData['maritalStatus'], $this->maritalStatusRepository)]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php index 8ae1dc4a2..fdb1a50b8 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php @@ -19,16 +19,21 @@ use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\Person\ResidentialAddress; use Chill\PersonBundle\Export\Declarations; use Chill\ThirdPartyBundle\Entity\ThirdPartyCategory; +use Chill\ThirdPartyBundle\Repository\ThirdPartyCategoryRepository; use Doctrine\ORM\Query\Expr; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; -class ResidentialAddressAtThirdpartyFilter implements FilterInterface +final readonly class ResidentialAddressAtThirdpartyFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; - public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, private readonly TranslatableStringHelper $translatableStringHelper) {} + public function __construct( + private RollingDateConverterInterface $rollingDateConverter, + private TranslatableStringHelper $translatableStringHelper, + private ThirdPartyCategoryRepository $thirdPartyCategoryRepository, + ) {} public function addRole(): ?string { @@ -113,7 +118,7 @@ class ResidentialAddressAtThirdpartyFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['thirdparty_cat' => $this->denormalizeDoctrineEntity($formData['thirdparty_cat'], $this->someRepository), 'date_calc' => RollingDate::fromNormalized($formData['date_calc'])]; + return ['thirdparty_cat' => $this->denormalizeDoctrineEntity($formData['thirdparty_cat'], $this->thirdPartyCategoryRepository), 'date_calc' => RollingDate::fromNormalized($formData['date_calc'])]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorFilter.php index 3a174e492..2eb447fca 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorFilter.php @@ -14,16 +14,22 @@ namespace Chill\PersonBundle\Export\Filter\SocialWorkFilters; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickUserDynamicType; +use Chill\MainBundle\Repository\UserRepositoryInterface; use Chill\PersonBundle\Export\Declarations; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; -class CreatorFilter implements FilterInterface +final readonly class CreatorFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; private const PREFIX = 'acpw_filter_creator'; + function __construct(private UserRepositoryInterface $userRepository) + { + + } + public function addRole(): ?string { return null; @@ -65,7 +71,7 @@ class CreatorFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['creators' => $this->denormalizeDoctrineEntity($formData['creators'], $this->someRepository)]; + return ['creators' => $this->denormalizeDoctrineEntity($formData['creators'], $this->userRepository)]; } public function describeAction($data, $format = 'string'): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorJobFilter.php index f4e4018bc..28d409670 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorJobFilter.php @@ -22,14 +22,14 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; -class CreatorJobFilter implements FilterInterface +final readonly class CreatorJobFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; private const PREFIX = 'acpw_filter_creator_job'; public function __construct( - private readonly UserJobRepository $userJobRepository, - private readonly TranslatableStringHelper $translatableStringHelper, + private UserJobRepository $userJobRepository, + private TranslatableStringHelper $translatableStringHelper, ) {} public function addRole(): ?string @@ -91,7 +91,7 @@ class CreatorJobFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['jobs' => $this->denormalizeDoctrineEntity($formData['jobs'], $this->someRepository)]; + return ['jobs' => $this->denormalizeDoctrineEntity($formData['jobs'], $this->userJobRepository)]; } public function describeAction($data, $format = 'string'): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorScopeFilter.php index afd3d43f7..390e2edca 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorScopeFilter.php @@ -91,7 +91,7 @@ class CreatorScopeFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['scopes' => $this->denormalizeDoctrineEntity($formData['scopes'], $this->someRepository)]; + return ['scopes' => $this->denormalizeDoctrineEntity($formData['scopes'], $this->scopeRepository)]; } public function describeAction($data, $format = 'string'): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php index 890ed6a9b..74082fee0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php @@ -15,23 +15,21 @@ use Chill\MainBundle\Entity\UserJob; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Repository\UserJobRepositoryInterface; use Chill\MainBundle\Service\RollingDate\RollingDate; -use Chill\MainBundle\Templating\TranslatableStringHelper; +use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkReferrerHistory; use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Contracts\Translation\TranslatorInterface; -class JobFilter implements FilterInterface +final readonly class JobFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; private const PREFIX = 'acp_work_action_filter_user_job'; public function __construct( - protected TranslatorInterface $translator, - private readonly TranslatableStringHelper $translatableStringHelper, - private readonly UserJobRepositoryInterface $userJobRepository, + private TranslatableStringHelperInterface $translatableStringHelper, + private UserJobRepositoryInterface $userJobRepository, ) {} public function addRole(): ?string @@ -85,7 +83,7 @@ class JobFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['job' => $this->denormalizeDoctrineEntity($formData['job'], $this->someRepository)]; + return ['job' => $this->denormalizeDoctrineEntity($formData['job'], $this->userJobRepository)]; } public function describeAction($data, $format = 'string') diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php index 00047f52d..9b1a1a57c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php @@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Export\Filter\SocialWorkFilters; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickRollingDateType; use Chill\MainBundle\Form\Type\PickUserDynamicType; +use Chill\MainBundle\Repository\UserRepositoryInterface; use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; use Chill\PersonBundle\Export\Declarations; @@ -25,7 +26,7 @@ final readonly class ReferrerFilter implements FilterInterface use \Chill\MainBundle\Export\ExportDataNormalizerTrait; private const PREFIX = 'acpw_referrer_filter'; - public function __construct(private RollingDateConverterInterface $rollingDateConverter) {} + public function __construct(private RollingDateConverterInterface $rollingDateConverter, private UserRepositoryInterface $userRepository) {} public function addRole(): ?string { @@ -80,7 +81,7 @@ final readonly class ReferrerFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['accepted_agents' => $this->denormalizeDoctrineEntity($formData['accepted_agents'], $this->someRepository), 'agent_at' => RollingDate::fromNormalized($formData['agent_at'])]; + return ['accepted_agents' => $this->denormalizeDoctrineEntity($formData['accepted_agents'], $this->userRepository), 'agent_at' => RollingDate::fromNormalized($formData['agent_at'])]; } public function getFormDefaultData(): array diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php index 33a9033c9..485bf78bd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php @@ -23,15 +23,14 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Contracts\Translation\TranslatorInterface; -class ScopeFilter implements FilterInterface +final readonly class ScopeFilter implements FilterInterface { use \Chill\MainBundle\Export\ExportDataNormalizerTrait; private const PREFIX = 'acp_work_action_filter_user_scope'; public function __construct( - protected TranslatorInterface $translator, - private readonly TranslatableStringHelper $translatableStringHelper, - private readonly ScopeRepositoryInterface $scopeRepository, + private TranslatableStringHelper $translatableStringHelper, + private ScopeRepositoryInterface $scopeRepository, ) {} public function addRole(): ?string @@ -84,7 +83,7 @@ class ScopeFilter implements FilterInterface public function denormalizeFormData(array $formData, int $fromVersion): array { - return ['scope' => $this->denormalizeDoctrineEntity($formData['scope'], $this->someRepository)]; + return ['scope' => $this->denormalizeDoctrineEntity($formData['scope'], $this->scopeRepository)]; } public function describeAction($data, $format = 'string'): array diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/OriginRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/OriginRepository.php index 2e50386c8..726418b12 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/OriginRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/OriginRepository.php @@ -12,15 +12,16 @@ declare(strict_types=1); namespace Chill\PersonBundle\Repository\AccompanyingPeriod; use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin; -use Doctrine\ORM\EntityManagerInterface; -use Doctrine\ORM\EntityRepository; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; -final readonly class OriginRepository +/** + * @extends ServiceEntityRepository + */ +final class OriginRepository extends ServiceEntityRepository { - private EntityRepository $repository; - - public function __construct(EntityManagerInterface $entityManager) + public function __construct(ManagerRegistry $registry) { - $this->repository = $entityManager->getRepository(Origin::class); + parent::__construct($registry, Origin::class); } } diff --git a/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepositoryInterface.php b/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepositoryInterface.php index 1f51060e9..d5ff1c6bd 100644 --- a/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepositoryInterface.php +++ b/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepositoryInterface.php @@ -12,8 +12,9 @@ declare(strict_types=1); namespace Chill\PersonBundle\Repository; use Chill\PersonBundle\Entity\MaritalStatus; +use Doctrine\Persistence\ObjectRepository; -interface MaritalStatusRepositoryInterface +interface MaritalStatusRepositoryInterface extends ObjectRepository { public function find($id): ?MaritalStatus;