diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php index e43d524a4..39729aa96 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\MainBundle\Entity\Workflow; use Chill\MainBundle\Entity\User; +use Chill\MainBundle\Validator\Constraints\Entity\WorkflowStepUsers; use DateTimeImmutable; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; @@ -24,6 +25,7 @@ use function in_array; /** * @ORM\Entity * @ORM\Table("chill_main_workflow_entity_step") + * @WorkflowStepUsers() */ class EntityWorkflowStep { diff --git a/src/Bundle/ChillMainBundle/Validator/Constraints/Entity/WorkflowStepUsers.php b/src/Bundle/ChillMainBundle/Validator/Constraints/Entity/WorkflowStepUsers.php new file mode 100644 index 000000000..842df37cf --- /dev/null +++ b/src/Bundle/ChillMainBundle/Validator/Constraints/Entity/WorkflowStepUsers.php @@ -0,0 +1,27 @@ +getCcUser() as $u) { + if ($value->getCcUser()->contains($u)) { + $this->context + ->buildViolation($constraint->message) + ->atPath('ccUsers') + ->addViolation(); + } + } + } +}