mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 18:43:49 +00:00
refactor: Upgrade repositories.
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Chill\PersonBundle\Repository;
|
||||
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Entity\PersonNotDuplicate;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
/**
|
||||
@@ -11,8 +12,15 @@ use Doctrine\ORM\EntityRepository;
|
||||
*
|
||||
* @package Chill\PersonBundle\Repository
|
||||
*/
|
||||
class PersonNotDuplicateRepository extends EntityRepository
|
||||
final class PersonNotDuplicateRepository
|
||||
{
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
$this->repository = $entityManager->getRepository(PersonNotDuplicate::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Chill\PersonBundle\Entity\Person $person
|
||||
*
|
||||
@@ -20,7 +28,7 @@ class PersonNotDuplicateRepository extends EntityRepository
|
||||
*/
|
||||
public function findNotDuplicatePerson(Person $person)
|
||||
{
|
||||
$qb = $this->createQueryBuilder('pnd');
|
||||
$qb = $this->repository->createQueryBuilder('pnd');
|
||||
$qb->select('pnd')
|
||||
->where('pnd.person1 = :person OR pnd.person2 = :person')
|
||||
;
|
||||
|
Reference in New Issue
Block a user