Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
saveFileToMediaDir example
$metaData
=
$this
->metadataLoader->
loadFromFile
(
$mediaFile
,
$mediaType
)
;
$media
=
$this
->
updateMediaEntity
(
$mediaFile
,
$destination
,
$currentMedia
,
$metaData
,
$mediaType
,
$context
)
;
$this
->
saveFileToMediaDir
(
$mediaFile
,
$media
)
;
$message
=
new
GenerateThumbnailsMessage
(
)
;
$message
->
setMediaIds
(
[
$mediaId
]
)
;
if
(
Feature::
isActive
(
'v6.6.0.0'
)
)
{
$message
->
setContext
(
$context
)
;
}
else
{
$message
->
withContext
(
$context
)
;
}
$this
->messageBus->
dispatch
(
$message
)
;
}