public function send(array
$data, Context
$context, array
$templateData =
[]): ?Email
{ $event =
new MailBeforeValidateEvent($data,
$context,
$templateData);
$this->eventDispatcher->
dispatch($event);
$data =
$event->
getData();
$templateData =
$event->
getTemplateData();
if ($event->
isPropagationStopped()) { return null;
} $definition =
$this->
getValidationDefinition($context);
$this->dataValidator->
validate($data,
$definition);
$recipients =
$data['recipients'
];
$salesChannelId =
$data['salesChannelId'
];
$salesChannel = null;
if (($salesChannelId !== null && !
isset($templateData['salesChannel'
])) ||
$this->
isTestMode($data)) { $criteria =
$this->
getSalesChannelDomainCriteria($salesChannelId,
$context);
/** @var SalesChannelEntity|null $salesChannel */
$salesChannel =
$this->salesChannelRepository->
search($criteria,
$context)->
get($salesChannelId);