public function getDecorated(): AbstractDocumentRenderer
{ throw new DecorationPatternException(self::
class);
} private function getOrder(string
$orderId, string
$versionId, Context
$context, string
$deepLinkCode = ''
): OrderEntity
{ ['language_id' =>
$languageId] =
$this->
getOrdersLanguageId([$orderId],
$versionId,
$this->connection
)[0
];
// Get the correct order with versioning from reference invoice
$versionContext =
$context->
createWithVersionId($versionId)->
assign([ 'languageIdChain' =>
array_unique(array_filter([$languageId,
$context->
getLanguageId()])),
]);
$criteria = OrderDocumentCriteriaFactory::
create([$orderId],
$deepLinkCode) ->
addFilter(new EqualsFilter('lineItems.type', LineItem::CREDIT_LINE_ITEM_TYPE
));
/** @var ?OrderEntity $order */
$order =
$this->orderRepository->
search($criteria,
$versionContext)->
get($orderId);
if ($order) { return $order;
}