public function generate(string
$documentType, array
$operations, Context
$context): DocumentGenerationResult
{ $documentTypeId =
$this->
getDocumentTypeByName($documentType);
if ($documentTypeId === null
) { throw new InvalidDocumentRendererException($documentType);
} $rendered =
$this->rendererRegistry->
render($documentType,
$operations,
$context,
new DocumentRendererConfig());
$result =
new DocumentGenerationResult();
foreach ($rendered->
getErrors() as $orderId =>
$error) { $result->
addError($orderId,
$error);
} $records =
[];
$success =
$rendered->
getSuccess();
foreach ($operations as $orderId =>
$operation) { try {