$template = '@Framework/documents/credit_note.html.twig';
$ids = \
array_map(fn (DocumentGenerateOperation
$operation) =>
$operation->
getOrderId(),
$operations);
if (empty($ids)) { return $result;
} $referenceInvoiceNumbers =
[];
$orders =
new OrderCollection();
/** @var DocumentGenerateOperation $operation */
foreach ($operations as $operation) { try { $orderId =
$operation->
getOrderId();
$invoice =
$this->referenceInvoiceLoader->
load($orderId,
$operation->
getReferencedDocumentId(),
$rendererConfig->deepLinkCode
);
if (empty($invoice)) { throw new DocumentGenerationException('Can not generate credit note document because no invoice document exists. OrderId: ' .
$operation->
getOrderId());
}