security->isGranted('ROLE_ADMIN')) { throw new AccessDeniedException('Access denied: ROLE_ADMIN required.'); } $status = $this->statusRepository->find($id); if (null === $status) { throw new InvalidArgumentException(sprintf('TaskStatus with ID %d not found.', $id)); } if (null !== $label) { $status->setLabel($label); } if (null !== $category) { $status->setCategory( StatusCategory::tryFrom($category) ?? throw new InvalidArgumentException(sprintf('Unknown status category "%s".', $category)), ); } if (null !== $color) { $status->setColor($color); } if (null !== $position) { $status->setPosition($position); } if (null !== $isFinal) { $status->setIsFinal($isFinal); } $this->entityManager->flush(); return json_encode([ 'id' => $status->getId(), 'label' => $status->getLabel(), 'color' => $status->getColor(), 'position' => $status->getPosition(), 'isFinal' => $status->getIsFinal(), 'category' => $status->getCategory()->value, 'workflowId' => $status->getWorkflow()?->getId(), ]); } }