Skip to content

Commit

Permalink
Add emailUpdater
Browse files Browse the repository at this point in the history
  • Loading branch information
Dumazeau committed Apr 28, 2023
1 parent 7dac0cd commit 60b16f9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Domain/Email/AbstractEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -149,6 +150,10 @@ protected function customBodyParameters(): array
return [];
}

protected function emailUpdater(Email $email): void
{
}

final protected function getEmail(): ?Email
{
$template = $this->getTemplateSlug();
Expand All @@ -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));
Expand All @@ -192,6 +197,8 @@ final protected function getEmail(): ?Email
}
}

$this->emailUpdater($email);

return $email;
}

Expand Down

0 comments on commit 60b16f9

Please sign in to comment.