Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
preparePresetData example
$presetData
[
'elements'
]
=
$this
->
refreshElementData
(
$presetData
[
'elements'
]
)
;
$preset
->
setPresetData
(
json_encode
(
$presetData
)
)
;
if
(
!
$preset
->
getAssetsImported
(
)
)
{
$preset
->
setAssetsImported
(
true
)
;
}
$this
->modelManager->
flush
(
$preset
)
;
return
$this
->
preparePresetData
(
$presetData
)
;
}
private
function
refreshElementData
(
array
$elements
)
: array
{
$collectedComponents
=
array_column
(
$elements
, 'componentId'
)
;
$collectedComponents
=
array_keys
(
array_flip
(
$collectedComponents
)
)
;
$components
=
$this
->
getComponentData
(
$collectedComponents
)
;
if
(
$components
)
{
foreach
(
$elements
as
&
$element
)
{