*/ public array $futureDestUsers = []; /** * a list of future cc users for the next step. * * @var array|User[] */ public array $futureCcUsers = []; /** * A list of future @see{Person} with will sign the next step. * * @var list */ public array $futurePersonSignatures = []; /** * An eventual user which is requested to apply a signature. */ public ?User $futureUserSignature = null; /** * a list of future destinee third parties, when a workflow does send the document * to a remote third party. * * @var array */ #[Assert\All( new ThirdPartyHasEmail(), )] public array $futureDestineeThirdParties = []; /** * a list of future destinee emails, when a workflow does send the document to a remote * email. * * @var array */ #[Assert\All([ new Assert\NotBlank(), new Assert\Email(), ])] public array $futureDestineeEmails = []; #[Assert\NotNull] public ?Transition $transition = null; public string $comment = ''; public function __construct( public EntityWorkflow $entityWorkflow, ) {} /** * @return list */ public function getFutureDestUsers(): array { return array_values(array_filter($this->futureDestUsers, fn (User|UserGroup $user) => $user instanceof User)); } /** * @return list */ public function getFutureDestUserGroups(): array { return array_values(array_filter($this->futureDestUsers, fn (User|UserGroup $user) => $user instanceof UserGroup)); } #[Assert\Callback()] public function validateCCUserIsNotInDest(ExecutionContextInterface $context, $payload): void { foreach ($this->futureDestUsers as $u) { if (in_array($u, $this->futureCcUsers, true)) { $context ->buildViolation('workflow.The user in cc cannot be a dest user in the same workflow step') ->atPath('ccUsers') ->addViolation(); } } } }