Add ticket listing and related enhancements

Added a new functionality for listing tickets with the ability for the user to order the list. A method was added to the User class to identify if an object is an instance of User. Similarly, a method was added to the UserGroup class. User.php, UserGroup.php, TicketRepository.php, and TicketRepositoryInterface.php were updated. A new TicketListController, MotiveRepository, and SectionMenuBuilder were created. Translations were included, and services.yaml was updated.
This commit is contained in:
2024-05-31 12:32:01 +02:00
parent 50025044d3
commit 26dfa9b028
10 changed files with 285 additions and 1 deletions

View File

@@ -19,7 +19,7 @@ final readonly class TicketRepository implements TicketRepositoryInterface
{
private ObjectRepository $repository;
public function __construct(EntityManagerInterface $objectManager)
public function __construct(private EntityManagerInterface $objectManager)
{
$this->repository = $objectManager->getRepository($this->getClassName());
}
@@ -34,6 +34,14 @@ final readonly class TicketRepository implements TicketRepositoryInterface
return $this->repository->findAll();
}
/**
* @return list<Ticket>
*/
public function findAllOrdered(): array
{
return $this->objectManager->createQuery('SELECT t FROM '.$this->getClassName().' t ORDER BY t.id DESC')->getResult();
}
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);