58 lines
1.5 KiB
PHP
58 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KupShop\PreordersBundle\Email;
|
|
|
|
use KupShop\KupShopBundle\Email\BaseEmail;
|
|
use KupShop\KupShopBundle\Email\EmailGroupTypeEnum;
|
|
use KupShop\PreordersBundle\Entity\UserPreorder;
|
|
use KupShop\PreordersBundle\Entity\UserPreorderMessage;
|
|
|
|
class UserPreorderEmail extends BaseEmail
|
|
{
|
|
protected static $name = 'Zpráva předobjednávky uživatele';
|
|
protected static $type = 'PREORDER_MESSAGE';
|
|
protected static $priority = -1;
|
|
protected static $group = EmailGroupTypeEnum::PREORDER;
|
|
protected $subject = 'Informace k Vaší předobjednávce';
|
|
protected $defaultEnabled = 'Y';
|
|
|
|
private UserPreorderMessage $message;
|
|
protected UserPreorder $userPreorder;
|
|
|
|
public function setMessage(UserPreorderMessage $message): self
|
|
{
|
|
$this->message = $message;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function setUserPreorder(UserPreorder $userPreorder): self
|
|
{
|
|
$this->userPreorder = $userPreorder;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getEmail($replacements = []): array
|
|
{
|
|
$replacements += [
|
|
'EMAIL' => $this->message->text,
|
|
];
|
|
|
|
$message = parent::getEmail($replacements);
|
|
$message['to'] = $this->userPreorder->getUser()->email;
|
|
|
|
return $message;
|
|
}
|
|
|
|
public function testEmail(): array
|
|
{
|
|
return parent::getEmail([
|
|
'EMAIL' => 'Testovací zpráva předobjednávky uživatele!',
|
|
'to' => 'test@test.cz',
|
|
]);
|
|
}
|
|
}
|