diff --git a/src/Domain/Email/AbstractEmail.php b/src/Domain/Email/AbstractEmail.php index b55dd09..feba18a 100644 --- a/src/Domain/Email/AbstractEmail.php +++ b/src/Domain/Email/AbstractEmail.php @@ -6,7 +6,6 @@ use RichId\EmailTemplateBundle\Domain\Attachment\Attachment; use RichId\EmailTemplateBundle\Domain\Constant; -use RichId\EmailTemplateBundle\Domain\Email\Trait\EmailDataTrait; use RichId\EmailTemplateBundle\Domain\Exception\InvalidEmailServiceException; use RichId\EmailTemplateBundle\Domain\Fetcher\EmailTemplateFetcher; use RichId\EmailTemplateBundle\Domain\Model\EmailModelInterface; @@ -27,6 +26,8 @@ abstract class AbstractEmail protected const TRANSLATION_DOMAIN = 'emails'; protected const TEMPLATING_FOLDER = 'emails'; + protected const EMAIL_CLASS = Email::class; + #[Required] public TemplatingInterface $templating; @@ -149,6 +150,10 @@ protected function customBodyParameters(): array return []; } + protected function emailUpdater(Email $email): void + { + } + final protected function getEmail(): ?Email { $template = $this->getTemplateSlug(); @@ -169,7 +174,7 @@ final protected function getEmail(): ?Email return null; } - $email = new Email(); + $email = new (static::EMAIL_CLASS)(); $email->subject($this->getSubject()) ->html($this->getBody()) ->to(...\array_unique($to)); @@ -192,6 +197,8 @@ final protected function getEmail(): ?Email } } + $this->emailUpdater($email); + return $email; }