mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
processing of review. still ACL left to do
This commit is contained in:
@@ -3,30 +3,50 @@
|
||||
namespace Chill\PersonBundle\Repository\Relationships;
|
||||
|
||||
use Chill\PersonBundle\Entity\Relationships\Relationship;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
/**
|
||||
* @method Relationship|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Relationship|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Relationship[] findAll()
|
||||
* @method Relationship[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class RelationshipRepository extends ServiceEntityRepository
|
||||
class RelationshipRepository implements ObjectRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
parent::__construct($registry, Relationship::class);
|
||||
$this->repository = $em->getRepository(Relationship::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Relationship[] Returns an array of Relationship objects linked to certain person.
|
||||
// */
|
||||
public function find($id): ?Relationship
|
||||
{
|
||||
return $this->repository->find($id);
|
||||
}
|
||||
|
||||
public function findAll(): array
|
||||
{
|
||||
return $this->repository->findAll();
|
||||
}
|
||||
|
||||
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): ?Relationship
|
||||
{
|
||||
return $this->findOneBy($criteria);
|
||||
}
|
||||
|
||||
public function getClassName(): string
|
||||
{
|
||||
return MaritalStatus::class;
|
||||
}
|
||||
|
||||
public function findByPerson($personId)
|
||||
public function findByPerson($personId): array
|
||||
{
|
||||
// return all relationships of which person is part? or only where person is the fromPerson?
|
||||
return $this->createQueryBuilder('r')
|
||||
return $this->repository->createQueryBuilder('r')
|
||||
->select('r, t') // entity Relationship
|
||||
->join('r.relation', 't')
|
||||
->where('r.fromPerson = :val')
|
||||
|
Reference in New Issue
Block a user