Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
downloadFileFromFilesystem example
'success' => false,
'message' => 'No valid order id passed.',
]
)
;
return
;
}
$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
)
;
}