From 02ca9add522d794a67cb0482c326a67917e45f54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 20 Oct 2021 20:49:44 +0200 Subject: [PATCH] refactor naming ReferralsAvailable => referralSuggestion --- .../Suggestion/ReferralAvailable.php | 31 ------------------- .../Suggestion/ReferralsSuggestion.php | 26 ++++++++++++++++ ...e.php => ReferralsSuggestionInterface.php} | 6 ++-- .../AccompanyingCourseApiController.php | 10 +++--- .../config/services/accompanyingPeriod.yaml | 4 +-- 5 files changed, 36 insertions(+), 41 deletions(-) delete mode 100644 src/Bundle/ChillPersonBundle/AccompanyingPeriod/Suggestion/ReferralAvailable.php create mode 100644 src/Bundle/ChillPersonBundle/AccompanyingPeriod/Suggestion/ReferralsSuggestion.php rename src/Bundle/ChillPersonBundle/AccompanyingPeriod/Suggestion/{ReferralAvailableInterface.php => ReferralsSuggestionInterface.php} (68%) diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Suggestion/ReferralAvailable.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Suggestion/ReferralAvailable.php deleted file mode 100644 index d70342610..000000000 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Suggestion/ReferralAvailable.php +++ /dev/null @@ -1,31 +0,0 @@ -userRepository = $userRepository; - } - - public function countReferralAvailable(AccompanyingPeriod $period, ?array $options = []): int - { - return $this->userRepository->countByActive(); - } - - /** - * @param AccompanyingPeriod $period - * @return array|User[] - */ - public function findReferralAvailable(AccompanyingPeriod $period, int $limit = 50, int $start = 0): array - { - return $this->userRepository->findByActive(); - } -} diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Suggestion/ReferralsSuggestion.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Suggestion/ReferralsSuggestion.php new file mode 100644 index 000000000..b28dcce79 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Suggestion/ReferralsSuggestion.php @@ -0,0 +1,26 @@ +eventDispatcher = $eventDispatcher; $this->validator = $validator; @@ -209,11 +209,11 @@ $workflow = $this->registry->get($accompanyingPeriod); { $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $period); - $total = $this->referralAvailable->countReferralAvailable($period); + $total = $this->referralAvailable->countReferralSuggested($period); $paginator = $this->getPaginatorFactory()->create($total); if (0 < $total) { - $users = $this->referralAvailable->findReferralAvailable($period, $paginator->getItemsPerPage(), + $users = $this->referralAvailable->findReferralSuggested($period, $paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber()); } else { $users = []; diff --git a/src/Bundle/ChillPersonBundle/config/services/accompanyingPeriod.yaml b/src/Bundle/ChillPersonBundle/config/services/accompanyingPeriod.yaml index 5b8639146..d9e784239 100644 --- a/src/Bundle/ChillPersonBundle/config/services/accompanyingPeriod.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/accompanyingPeriod.yaml @@ -14,9 +14,9 @@ services: lazy: true method: preUpdateAccompanyingPeriod - Chill\PersonBundle\AccompanyingPeriod\Suggestion\ReferralAvailable: + Chill\PersonBundle\AccompanyingPeriod\Suggestion\ReferralsSuggestion: autowire: true autoconfigure: true - Chill\PersonBundle\AccompanyingPeriod\Suggestion\ReferralAvailableInterface: '@Chill\PersonBundle\AccompanyingPeriod\Suggestion\ReferralAvailable' + Chill\PersonBundle\AccompanyingPeriod\Suggestion\ReferralsSuggestionInterface: '@Chill\PersonBundle\AccompanyingPeriod\Suggestion\ReferralsSuggestion'