Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createImagesForOptions example
$options
=
[
]
;
foreach
(
$mappingData
[
'rules'
]
as
$ruleData
)
{
$rule
=
new
Rule
(
)
;
$option
=
$this
->
get
(
'models'
)
->
getReference
(
Option::
class
,
$ruleData
[
'optionId'
]
)
;
$rule
->
setMapping
(
$mapping
)
;
$rule
->
setOption
(
$option
)
;
$mapping
->
getRules
(
)
->
add
(
$rule
)
;
$options
[
]
=
$option
;
}
$mapping
->
setImage
(
$image
)
;
$this
->
get
(
'models'
)
->
persist
(
$mapping
)
;
$this
->
createImagesForOptions
(
$options
,
$imageData
,
$image
)
;
$mappingModels
[
]
=
$mapping
;
}
$image
->
setMappings
(
$mappingModels
)
;
$this
->
get
(
'models'
)
->
persist
(
$image
)
;
$this
->
get
(
'models'
)
->
flush
(
)
;
$result
=
$this
->
getRepository
(
)
->
getArticleImageQuery
(
$imageId
)
->
getArrayResult
(
)
;
$this
->
View
(
)
->
assign
(
[
'success' => true, 'data' =>
$result
]
)
;
}