From 6e37e7feacd22f0c7721cc934274f0c57b287f04 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 23 Jun 2021 16:40:43 +0200 Subject: [PATCH] Let repositories implements ObjectRepository. --- .../SocialWork/EvaluationRepository.php | 39 ++++++++++++++++++- .../Repository/SocialWork/GoalRepository.php | 38 +++++++++++++++++- .../SocialWork/ResultRepository.php | 38 +++++++++++++++++- .../SocialWork/SocialActionRepository.php | 37 +++++++++++++++++- .../SocialWork/SocialIssueRepository.php | 29 ++++++-------- 5 files changed, 160 insertions(+), 21 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepository.php index f554e4e8c..d0f11c2d3 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepository.php @@ -5,8 +5,9 @@ namespace Chill\PersonBundle\Repository\SocialWork; use Chill\PersonBundle\Entity\SocialWork\Evaluation; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; +use Doctrine\Persistence\ObjectRepository; -final class EvaluationRepository +final class EvaluationRepository implements ObjectRepository { private EntityRepository $repository; @@ -14,4 +15,40 @@ final class EvaluationRepository { $this->repository = $entityManager->getRepository(Evaluation::class); } + + public function find($id, ?int $lockMode = null, ?int $lockVersion = null): ?Evaluation + { + return $this->repository->find($id, $lockMode, $lockVersion); + } + + /** + * @return array + */ + public function findAll(): array + { + return $this->repository->findAll(); + } + + /** + * @return array + */ + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array + { + return $this->repository->findBy($criteria, $orderBy, $limit, $offset); + } + + public function findOneBy(array $criteria, ?array $orderBy = null): ?Evaluation + { + return $this->repository->findOneBy($criteria, $orderBy); + } + + /** + * @return class-string + */ + public function getClassName(): string + { + return Evaluation::class; + } + + } diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php index bd7c6a738..cb2815d89 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php @@ -5,8 +5,9 @@ namespace Chill\PersonBundle\Repository\SocialWork; use Chill\PersonBundle\Entity\SocialWork\Goal; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; +use Doctrine\Persistence\ObjectRepository; -final class GoalRepository +final class GoalRepository implements ObjectRepository { private EntityRepository $repository; @@ -14,4 +15,39 @@ final class GoalRepository { $this->repository = $entityManager->getRepository(Goal::class); } + + public function find($id, ?int $lockMode = null, ?int $lockVersion = null): ?Goal + { + return $this->repository->find($id, $lockMode, $lockVersion); + } + + /** + * @return array + */ + public function findAll(): array + { + return $this->repository->findAll(); + } + + /** + * @return array + */ + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array + { + return $this->repository->findBy($criteria, $orderBy, $limit, $offset); + } + + public function findOneBy(array $criteria, ?array $orderBy = null): ?Goal + { + return $this->repository->findOneBy($criteria, $orderBy); + } + + /** + * @return class-string + */ + public function getClassName(): string + { + return Goal::class; + } + } diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php index 1c4d8d013..047e4325f 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php @@ -5,8 +5,9 @@ namespace Chill\PersonBundle\Repository\SocialWork; use Chill\PersonBundle\Entity\SocialWork\Result; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; +use Doctrine\Persistence\ObjectRepository; -final class ResultRepository +final class ResultRepository implements ObjectRepository { private EntityRepository $repository; @@ -14,4 +15,39 @@ final class ResultRepository { $this->repository = $entityManager->getRepository(Result::class); } + + public function find($id, ?int $lockMode = null, ?int $lockVersion = null): ?Result + { + return $this->repository->find($id, $lockMode, $lockVersion); + } + + /** + * @return array + */ + public function findAll(): array + { + return $this->repository->findAll(); + } + + /** + * @return array + */ + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array + { + return $this->repository->findBy($criteria, $orderBy, $limit, $offset); + } + + public function findOneBy(array $criteria, ?array $orderBy = null): ?Result + { + return $this->repository->findOneBy($criteria, $orderBy); + } + + /** + * @return class-string + */ + public function getClassName(): string + { + return Result::class; + } + } diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php index 3c86d2397..a81789c0a 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php @@ -5,8 +5,9 @@ namespace Chill\PersonBundle\Repository\SocialWork; use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; +use Doctrine\Persistence\ObjectRepository; -final class SocialActionRepository +final class SocialActionRepository implements ObjectRepository { private EntityRepository $repository; @@ -14,4 +15,38 @@ final class SocialActionRepository { $this->repository = $entityManager->getRepository(SocialAction::class); } + + public function find($id, ?int $lockMode = null, ?int $lockVersion = null): ?SocialAction + { + return $this->repository->find($id, $lockMode, $lockVersion); + } + + /** + * @return array + */ + public function findAll(): array + { + return $this->repository->findAll(); + } + + /** + * @return array + */ + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array + { + return $this->repository->findBy($criteria, $orderBy, $limit, $offset); + } + + public function findOneBy(array $criteria, ?array $orderBy = null): ?SocialAction + { + return $this->repository->findOneBy($criteria, $orderBy); + } + + /** + * @return class-string + */ + public function getClassName(): string + { + return SocialAction::class; + } } diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialIssueRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialIssueRepository.php index 4dc5ecc67..b0324ba33 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialIssueRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialIssueRepository.php @@ -1,9 +1,10 @@ repository = $entityManager->getRepository(SocialIssue::class); } - /** - * {@inheritDoc} - */ - public function find($id) + public function find($id, ?int $lockMode = null, ?int $lockVersion = null): ?SocialIssue { - return $this->repository->find($id); + return $this->repository->find($id, $lockMode, $lockVersion); } /** - * {@inheritDoc} + * @return array */ - public function findAll() + public function findAll(): array { return $this->repository->findAll(); } /** - * {@inheritDoc} + * @return array */ - public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null) + public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - /** - * {@inheritDoc} - */ - public function findOneBy(array $criteria) + public function findOneBy(array $criteria, ?array $orderBy = null): ?SocialIssue { - return $this->findOneBy($criteria); + return $this->repository->findOneBy($criteria, $orderBy); } /** - * {@inheritDoc} + * @return class-string */ - public function getClassName() + public function getClassName(): string { return SocialIssue::class; }