Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getArticleImageDataQuery example
public
function
saveMediaMappingAction
(
)
{
$imageId
=
(int)
$this
->
Request
(
)
->
getParam
(
'id'
)
;
$mappings
=
$this
->
Request
(
)
->
getParam
(
'mappings'
)
;
if
(
empty
(
$imageId
)
||
$imageId
<= 0
)
{
$this
->
View
(
)
->
assign
(
[
'success' => false, 'noId' => true
]
)
;
return
;
}
$query
=
$this
->
getRepository
(
)
->
getArticleImageDataQuery
(
$imageId
)
;
$image
=
$query
->
getOneOrNullResult
(
AbstractQuery::HYDRATE_OBJECT
)
;
if
(
!
$image
instanceof Image
)
{
throw
new
ModelNotFoundException
(
Image::
class
,
$imageId
)
;
}
$imageData
=
$query
->
getOneOrNullResult
(
AbstractQuery::HYDRATE_ARRAY
)
;
$this
->
getRepository
(
)
->
getDeleteImageChildrenQuery
(
$imageId
)
->
execute
(
)
;
$mappingModels
=
[
]
;
foreach
(
$mappings
as
$mappingData
)
{
if
(
empty
(
$mappingData
[
'rules'
]
)
)
{