From 4fe4f6a87777146cca8702c09e354e778a775bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 22 Sep 2022 14:01:30 +0200 Subject: [PATCH] DXFeature: ClosingMotiveRepository implements correct interace --- .../ClosingMotiveAggregator.php | 5 +-- .../ClosingMotiveRepository.php | 34 ++++++++++++++++++- .../ClosingMotiveRepositoryInterface.php | 13 +++++++ 3 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepositoryInterface.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php index f9923c554..de276f007 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php @@ -16,18 +16,19 @@ use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Repository\AccompanyingPeriod\ClosingMotiveRepository; +use Chill\PersonBundle\Repository\AccompanyingPeriod\ClosingMotiveRepositoryInterface; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; class ClosingMotiveAggregator implements AggregatorInterface { - private EntityManagerInterface $em; + private ClosingMotiveRepositoryInterface $motiveRepository; private TranslatableStringHelper $translatableStringHelper; public function __construct( - ClosingMotiveRepository $motiveRepository, + ClosingMotiveRepositoryInterface $motiveRepository, TranslatableStringHelper $translatableStringHelper ) { $this->motiveRepository = $motiveRepository; diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php index ea5b1feff..283dac151 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php @@ -15,8 +15,9 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Query\ResultSetMappingBuilder; +use UnexpectedValueException; -final class ClosingMotiveRepository +final class ClosingMotiveRepository implements ClosingMotiveRepositoryInterface { private EntityManagerInterface $entityManager; @@ -54,4 +55,35 @@ final class ClosingMotiveRepository ->createNativeQuery($sql, $rsm) ->getResult(); } + + public function find($id): ?ClosingMotive + { + return $this->repository->find($id); + } + + /** + * @return array|ClosingMotive[] + */ + public function findAll(): array + { + return $this->repository->findAll(); + } + + /** + * @return array|ClosingMotive[] + */ + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array + { + return $this->repository->findBy($criteria, $orderBy, $limit, $offset); + } + + public function findOneBy(array $criteria): ?ClosingMotive + { + return $this->findOneBy($criteria); + } + + public function getClassName(): string + { + return ClosingMotive::class; + } } diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepositoryInterface.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepositoryInterface.php new file mode 100644 index 000000000..fbea29a0b --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepositoryInterface.php @@ -0,0 +1,13 @@ +