security->isGranted('ROLE_USER')) { throw new AccessDeniedException('Access denied: ROLE_USER required.'); } if (null !== $projectId) { $project = $this->entityManager->find(Project::class, $projectId); if (!$project) { return json_encode(['error' => 'Project not found.']); } $statuses = $project->getWorkflow()->getStatuses()->toArray(); } else { $statuses = $this->taskStatusRepository->findBy([], ['position' => 'ASC']); } return json_encode(array_map(fn ($s) => [ 'id' => $s->getId(), 'label' => $s->getLabel(), 'color' => $s->getColor(), 'position' => $s->getPosition(), 'isFinal' => $s->getIsFinal(), 'category' => $s->getCategory()->value, 'workflowId' => $s->getWorkflow()?->getId(), ], $statuses)); } }