Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
putStream example
return
$this
->filesystem->
put
(
$this
->prefix .
$path
,
$contents
,
$config
)
;
}
/** * {@inheritdoc} */
public
function
putStream
(
$path
,
$resource
, array
$config
=
[
]
)
{
$this
->
checkPath
(
$path
)
;
return
$this
->filesystem->
putStream
(
$this
->prefix .
$path
,
$resource
,
$config
)
;
}
/** * {@inheritdoc} */
public
function
readAndDelete
(
$path
)
{
$this
->
checkPath
(
$path
)
;
return
$this
->filesystem->
readAndDelete
(
$this
->prefix .
$path
)
;
}
$mpdf
=
new
Mpdf
(
$mpdfConfig
)
;
$mpdf
->
setLogger
(
Shopware
(
)
->
Container
(
)
->
get
(
'corelogger'
)
)
;
$mpdf
->
WriteHTML
(
$html
)
;
$mpdf
->
Output
(
$tmpFile
, 'F'
)
;
$stream
=
fopen
(
$tmpFile
, 'rb'
)
;
$path
=
sprintf
(
'documents/%s.pdf',
$this
->_documentHash
)
;
$filesystem
=
Shopware
(
)
->
Container
(
)
->
get
(
'shopware.filesystem.private'
)
;
$filesystem
->
putStream
(
$path
,
$stream
)
;
unlink
(
$tmpFile
)
;
}
}
/** * Assign configuration / data to template */
public
function
assignValues
(
)
{
$this
->
loadConfiguration4x
(
)
;
/** * {@inheritdoc} */
public
function
writeStream
(
$path
,
$resource
,
$append
= false
)
{
$path
=
$this
->strategy->
encode
(
$path
)
;
if
(
$append
=== false &&
$this
->filesystem->
has
(
$path
)
)
{
$this
->filesystem->
delete
(
$path
)
;
}
$this
->filesystem->
putStream
(
$path
,
$resource
)
;
return
true;
}
/** * {@inheritdoc} */
public
function
has
(
$path
)
{
$this
->
migrateFileLive
(
$path
)
;
$path
=
$this
->strategy->
encode
(
$path
)
;