security->isGranted('ROLE_USER')) { throw new AccessDeniedException('Access denied: ROLE_USER required.'); } $group = $this->taskGroupRepository->findById($id); if (null === $group) { throw new InvalidArgumentException(sprintf('TaskGroup with ID %d not found.', $id)); } if (null !== $title) { $group->setTitle($title); } if (null !== $description) { $group->setDescription($description); } if (null !== $color) { $group->setColor($color); } if (null !== $archived) { $group->setArchived($archived); } $this->entityManager->flush(); return json_encode(Serializer::groupFull($group)); } }