mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fix missing dependency.
This commit is contained in:
parent
1f4735caac
commit
5cc5e6a1f7
@ -27,31 +27,27 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ClosingMotiveRepository
|
|
||||||
* Entity repository for closing motives
|
|
||||||
*
|
|
||||||
* @package Chill\PersonBundle\Repository
|
|
||||||
*/
|
|
||||||
final class ClosingMotiveRepository
|
final class ClosingMotiveRepository
|
||||||
{
|
{
|
||||||
private EntityRepository $repository;
|
private EntityRepository $repository;
|
||||||
|
|
||||||
|
private EntityManagerInterface $entityManager;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $entityManager)
|
public function __construct(EntityManagerInterface $entityManager)
|
||||||
{
|
{
|
||||||
|
$this->entityManager = $entityManager;
|
||||||
$this->repository = $entityManager->getRepository(ClosingMotive::class);
|
$this->repository = $entityManager->getRepository(ClosingMotive::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $onlyLeaf
|
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getActiveClosingMotive(bool $onlyLeaf = true)
|
public function getActiveClosingMotive(bool $onlyLeaf = true)
|
||||||
{
|
{
|
||||||
$rsm = new ResultSetMappingBuilder($this->repository->getEntityManager());
|
$rsm = new ResultSetMappingBuilder($this->entityManager);
|
||||||
$rsm->addRootEntityFromClassMetadata($this->repository->getClassName(), 'cm');
|
$rsm->addRootEntityFromClassMetadata($this->repository->getClassName(), 'cm');
|
||||||
|
|
||||||
$sql = "SELECT ".(string) $rsm."
|
$sql = "SELECT " . (string) $rsm . "
|
||||||
FROM chill_person_accompanying_period_closingmotive AS cm
|
FROM chill_person_accompanying_period_closingmotive AS cm
|
||||||
WHERE
|
WHERE
|
||||||
active IS TRUE ";
|
active IS TRUE ";
|
||||||
@ -65,8 +61,7 @@ final class ClosingMotiveRepository
|
|||||||
$sql .= " ORDER BY cm.ordering ASC";
|
$sql .= " ORDER BY cm.ordering ASC";
|
||||||
|
|
||||||
return $this
|
return $this
|
||||||
->repository
|
->entityManager
|
||||||
->getEntityManager()
|
|
||||||
->createNativeQuery($sql, $rsm)
|
->createNativeQuery($sql, $rsm)
|
||||||
->getResult();
|
->getResult();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user