Créer la page et la liste des tickets dans le dossier d'usager

This commit is contained in:
Boris Waaub
2025-10-15 11:06:02 +00:00
committed by Julien Fastré
parent 6d2e78ce55
commit 30bcb85549
17 changed files with 308 additions and 156 deletions

View File

@@ -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();
}
}