<?php
namespace App\EventListener;
use App\Event\CustomAdviceRequestSubmitEvent;
class CustomAdviceRequestListener extends FormSubmitEventListener
{
public function postCustomAdviceRequestSubmit(CustomAdviceRequestSubmitEvent $event)
{
$customAdviceRequest = $event->getCustomAdviceRequest();
if ($visitorMail = $this->getMail('site_advice_request_visitor_mail')) {
$this->mailer->mail(
$visitorMail,
$this->getCompanyEmailSender(),
[$customAdviceRequest->getEmail()],
['customAdviceRequest' => $customAdviceRequest]
);
}
if ($ownerMail = $this->getMail('site_advice_request_site_owner_mail')) {
$this->mailer->mail(
$ownerMail,
$this->getCompanyEmailSender(),
[$this->parameterBag->get('site_advice_request_recipient')],
['customAdviceRequest' => $customAdviceRequest]
);
}
}
}