$criteria =
new Criteria([$orderId]);
$criteria->
addAssociation('transactions.stateMachineState'
);
/** @var OrderEntity $order */
$order =
$orderRepository->
search($criteria,
$context)->
first();
$event =
new CheckoutOrderPlacedEvent($context,
$order, TestDefaults::SALES_CHANNEL
);
$documentIdOlder = null;
$documentIdNewer = null;
$documentIds =
[];
if ($documentTypeIds !== null &&
$documentTypeIds !==
[] ||
$hasOrderSettingAttachment) { $documentIdOlder =
$this->
createDocumentWithFile($orderId,
$context);
$documentIdNewer =
$this->
createDocumentWithFile($orderId,
$context);
$documentIds[] =
$documentIdNewer;
} if ($hasOrderSettingAttachment) { $event->
getContext()->
addExtension( MailSendSubscriberConfig::MAIL_CONFIG_EXTENSION,
new MailSendSubscriberConfig( false,
$documentIds,
) );