2a0b202d32
Deux lots regroupés sur la branche feat/absence-management. Suppression complète du portail client : - retire ROLE_CLIENT (security.yaml) ; User::getRoles() ajoute toujours ROLE_USER - supprime l'entité ClientTicket (+ repo, states, relations), User.client et User.allowedProjects, NotificationService, ProjectAllowedExtension, le bloc ROLE_CLIENT de MailAccessChecker - front : pages /portal, layout portal, composants client-ticket/, AdminClientTicketTab, services/dto/i18n/docs associés - fixtures : retire les users client-liot / client-acme - migration Version20260522110000 (drop client_ticket, user_allowed_projects, colonnes liées ; task_document.task_id -> NOT NULL) - tests : retire les cas obsolètes testant le blocage des clients sur le mail Module gestion des absences (WIP) : - entités / migrations (Version20260521160000, Version20260522090000) - pages absences.vue / team-absences.vue, composants frontend/components/absence/ - services front, AccrueLeaveCommand, PublicHolidayController Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
57 lines
1.5 KiB
PHP
57 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\State;
|
|
|
|
use ApiPlatform\Metadata\Operation;
|
|
use ApiPlatform\State\ProviderInterface;
|
|
use App\Entity\TaskDocument;
|
|
use App\Entity\User;
|
|
use Doctrine\ORM\EntityManagerInterface;
|
|
use Symfony\Bundle\SecurityBundle\Security;
|
|
|
|
/**
|
|
* @implements ProviderInterface<TaskDocument>
|
|
*/
|
|
final readonly class TaskDocumentProvider implements ProviderInterface
|
|
{
|
|
public function __construct(
|
|
private EntityManagerInterface $entityManager,
|
|
private Security $security,
|
|
) {}
|
|
|
|
public function provide(Operation $operation, array $uriVariables = [], array $context = []): array|TaskDocument|null
|
|
{
|
|
$user = $this->security->getUser();
|
|
assert($user instanceof User);
|
|
|
|
$repo = $this->entityManager->getRepository(TaskDocument::class);
|
|
|
|
// Single item
|
|
if (isset($uriVariables['id'])) {
|
|
return $repo->find($uriVariables['id']);
|
|
}
|
|
|
|
// Collection
|
|
$qb = $repo->createQueryBuilder('d')
|
|
->orderBy('d.id', 'DESC')
|
|
;
|
|
|
|
// Apply filters from query parameters
|
|
$filters = $context['filters'] ?? [];
|
|
if (isset($filters['task'])) {
|
|
$qb->andWhere('d.task = :task')
|
|
->setParameter('task', self::extractId($filters['task']))
|
|
;
|
|
}
|
|
|
|
return $qb->getQuery()->getResult();
|
|
}
|
|
|
|
private static function extractId(string $value): int
|
|
{
|
|
return is_numeric($value) ? (int) $value : (int) basename($value);
|
|
}
|
|
}
|