mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-21 04:32:51 +00:00
Créer la page et la liste des tickets dans le dossier d'usager
This commit is contained in:
@@ -11,6 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\TicketBundle\Repository;
|
||||
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\TicketBundle\Entity\Ticket;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
@@ -61,4 +62,19 @@ final readonly class TicketRepository implements TicketRepositoryInterface
|
||||
{
|
||||
return $this->repository->findOneBy(['externalRef' => $extId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count tickets associated with a person where endDate is null.
|
||||
*/
|
||||
public function countOpenedByPerson(Person $person): int
|
||||
{
|
||||
return (int) $this->objectManager->createQuery(
|
||||
'SELECT COUNT(DISTINCT t.id) FROM '.$this->getClassName().' t
|
||||
JOIN t.personHistories ph
|
||||
WHERE ph.person = :person
|
||||
AND ph.endDate IS NULL'
|
||||
)
|
||||
->setParameter('person', $person)
|
||||
->getSingleScalarResult();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user