mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-25 16:14:59 +00:00
add docgen:normalization for relation
This commit is contained in:
@@ -12,7 +12,6 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Repository\Relationships;
|
||||
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Entity\Relationships\Relation;
|
||||
use Chill\PersonBundle\Entity\Relationships\Relationship;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
@@ -21,16 +20,24 @@ use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
class RelationshipRepository implements ObjectRepository
|
||||
{
|
||||
private EntityRepository $repository;
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->repository = $em->getRepository(Relationship::class);
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
public function countByPerson(Person $person): int
|
||||
{
|
||||
return $this->buildQueryByPerson($person)
|
||||
->select('COUNT(p)')
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
}
|
||||
|
||||
public function find($id): ?Relationship
|
||||
{
|
||||
return $this->repository->find($id);
|
||||
@@ -47,7 +54,6 @@ class RelationshipRepository implements ObjectRepository
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Person $person
|
||||
* @return array|Relationship[]
|
||||
*/
|
||||
public function findByPerson(Person $person): array
|
||||
@@ -58,12 +64,14 @@ class RelationshipRepository implements ObjectRepository
|
||||
->getResult();
|
||||
}
|
||||
|
||||
public function countByPerson(Person $person): int
|
||||
public function findOneBy(array $criteria): ?Relationship
|
||||
{
|
||||
return $this->buildQueryByPerson($person)
|
||||
->select('COUNT(p)')
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
return $this->findOneBy($criteria);
|
||||
}
|
||||
|
||||
public function getClassName(): string
|
||||
{
|
||||
return Relationship::class;
|
||||
}
|
||||
|
||||
private function buildQueryByPerson(Person $person): QueryBuilder
|
||||
@@ -81,14 +89,4 @@ class RelationshipRepository implements ObjectRepository
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function findOneBy(array $criteria): ?Relationship
|
||||
{
|
||||
return $this->findOneBy($criteria);
|
||||
}
|
||||
|
||||
public function getClassName(): string
|
||||
{
|
||||
return Relationship::class;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user