template_identifier = $template_identifier; Log::debug(sprintf("AbstractEmailJob::__construct template_identifier %s", $template_identifier)); if(empty($this->template_identifier)){ throw new \InvalidArgumentException("missing template_identifier value"); } $this->payload = $payload; $this->to_email = $to_email; $this->subject = $subject; } /** * @param IMailApi $api * @return array * @throws \Exception */ public function handle ( IMailApi $api ) { try { Log::debug(sprintf("AbstractEmailJob::handle template_identifier %s to_email %s", $this->template_identifier, $this->to_email)); return $api->sendEmail($this->payload, $this->template_identifier, $this->to_email, $this->subject); } catch (\Exception $ex){ Log::error(sprintf("AbstractEmailJob::sendEmail template_identifier %s to_email %s", $this->template_identifier, $this->to_email)); Log::error($ex); throw $ex; } } abstract protected function getEmailEventSlug():string; /** * @param Summit $summit * @return string|null */ protected function getEmailTemplateIdentifierFromEmailEvent(Summit $summit):?string{ return $summit->getEmailIdentifierPerEmailEventFlowSlug($this->getEmailEventSlug()); } }