Let repositories implements ObjectRepository.

This commit is contained in:
Pol Dellaiera 2021-06-23 16:40:43 +02:00
parent df1f44d814
commit 6e37e7feac
5 changed files with 160 additions and 21 deletions

View File

@ -5,8 +5,9 @@ namespace Chill\PersonBundle\Repository\SocialWork;
use Chill\PersonBundle\Entity\SocialWork\Evaluation; use Chill\PersonBundle\Entity\SocialWork\Evaluation;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectRepository;
final class EvaluationRepository final class EvaluationRepository implements ObjectRepository
{ {
private EntityRepository $repository; private EntityRepository $repository;
@ -14,4 +15,40 @@ final class EvaluationRepository
{ {
$this->repository = $entityManager->getRepository(Evaluation::class); $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<int, Evaluation>
*/
public function findAll(): array
{
return $this->repository->findAll();
}
/**
* @return array<int, Evaluation>
*/
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;
}
} }

View File

@ -5,8 +5,9 @@ namespace Chill\PersonBundle\Repository\SocialWork;
use Chill\PersonBundle\Entity\SocialWork\Goal; use Chill\PersonBundle\Entity\SocialWork\Goal;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectRepository;
final class GoalRepository final class GoalRepository implements ObjectRepository
{ {
private EntityRepository $repository; private EntityRepository $repository;
@ -14,4 +15,39 @@ final class GoalRepository
{ {
$this->repository = $entityManager->getRepository(Goal::class); $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<int, Goal>
*/
public function findAll(): array
{
return $this->repository->findAll();
}
/**
* @return array<int, Goal>
*/
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;
}
} }

View File

@ -5,8 +5,9 @@ namespace Chill\PersonBundle\Repository\SocialWork;
use Chill\PersonBundle\Entity\SocialWork\Result; use Chill\PersonBundle\Entity\SocialWork\Result;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectRepository;
final class ResultRepository final class ResultRepository implements ObjectRepository
{ {
private EntityRepository $repository; private EntityRepository $repository;
@ -14,4 +15,39 @@ final class ResultRepository
{ {
$this->repository = $entityManager->getRepository(Result::class); $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<int, Result>
*/
public function findAll(): array
{
return $this->repository->findAll();
}
/**
* @return array<int, Result>
*/
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;
}
} }

View File

@ -5,8 +5,9 @@ namespace Chill\PersonBundle\Repository\SocialWork;
use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectRepository;
final class SocialActionRepository final class SocialActionRepository implements ObjectRepository
{ {
private EntityRepository $repository; private EntityRepository $repository;
@ -14,4 +15,38 @@ final class SocialActionRepository
{ {
$this->repository = $entityManager->getRepository(SocialAction::class); $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<int, SocialAction>
*/
public function findAll(): array
{
return $this->repository->findAll();
}
/**
* @return array<int, SocialAction>
*/
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;
}
} }

View File

@ -1,9 +1,10 @@
<?php <?php
declare(strict_types=1);
namespace Chill\PersonBundle\Repository\SocialWork; namespace Chill\PersonBundle\Repository\SocialWork;
use Chill\PersonBundle\Entity\SocialWork\SocialIssue; use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectRepository; use Doctrine\Persistence\ObjectRepository;
@ -17,42 +18,36 @@ final class SocialIssueRepository implements ObjectRepository
$this->repository = $entityManager->getRepository(SocialIssue::class); $this->repository = $entityManager->getRepository(SocialIssue::class);
} }
/** public function find($id, ?int $lockMode = null, ?int $lockVersion = null): ?SocialIssue
* {@inheritDoc}
*/
public function find($id)
{ {
return $this->repository->find($id); return $this->repository->find($id, $lockMode, $lockVersion);
} }
/** /**
* {@inheritDoc} * @return array<int, SocialIssue>
*/ */
public function findAll() public function findAll(): array
{ {
return $this->repository->findAll(); return $this->repository->findAll();
} }
/** /**
* {@inheritDoc} * @return array<int, SocialIssue>
*/ */
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); return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
} }
/** public function findOneBy(array $criteria, ?array $orderBy = null): ?SocialIssue
* {@inheritDoc}
*/
public function findOneBy(array $criteria)
{ {
return $this->findOneBy($criteria); return $this->repository->findOneBy($criteria, $orderBy);
} }
/** /**
* {@inheritDoc} * @return class-string
*/ */
public function getClassName() public function getClassName(): string
{ {
return SocialIssue::class; return SocialIssue::class;
} }