$files =
[];
$models =
$this->
getOrderDocumentsQuery($data->orders,
$data->docType
)->
getResult();
foreach ($models as $model) { foreach ($model->
getDocuments() as $document) { $file =
$this->
downloadFileFromFilesystem(sprintf('documents/%s.pdf',
$document->
getHash()));
if ($file !== null
) { $files[] =
$file;
} } } $this->
mergeDocuments($files);
// Remove temporary files
foreach ($files as $file) { unlink($file);
} } /**
* The sendMailAction fired from the batch window in the order backend module when the user want to send the order
* status mail manually.
*
* @return void
*/