security->isGranted('ROLE_USER')) { throw new AccessDeniedException('Access denied: ROLE_USER required.'); } $task = $this->taskRepository->find($id); if (null === $task) { throw new InvalidArgumentException(sprintf('Task with ID %d not found.', $id)); } return json_encode([ 'id' => $task->getId(), 'number' => $task->getNumber(), 'title' => $task->getTitle(), 'description' => $task->getDescription(), 'status' => Serializer::statusFull($task->getStatus()), 'priority' => Serializer::priority($task->getPriority()), 'effort' => Serializer::effort($task->getEffort()), 'assignee' => Serializer::user($task->getAssignee()), 'group' => Serializer::group($task->getGroup()), 'project' => Serializer::projectRef($task->getProject()), 'tags' => Serializer::tagsWithColor($task->getTags()), 'documents' => Serializer::documents($task->getDocuments()), 'archived' => $task->isArchived(), ]); } }