mailBus = $mailBus; $this->runCommand = $runCommand; $this->sender = $sender; $this->params = $params; $this->twig = $twig; } /** * @param $token */ public function execute(array $users, StartEndTransitionView $transition) { try { $this->runCommand->run(new SendMailCommand($this->mailBus), 'pim:workflow:send-mail', ['users' => $users, 'transition' => $transition]); return true; } catch (Exception $e) { dd($e->getMessage()); } } /** * @param User $user * * @throws LoaderError * @throws RuntimeError * @throws SyntaxError */ public function changePlace(array $emails, $body, $head, $message): ?int { $message = (new Swift_Message()) ->setSubject($head) ->setFrom('no-reply@syspad.fr') ->setTo($emails) ->setBody( $this->twig->render($body, $message ), 'text/html' ); return $this->sender->send($message); } }