Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
mediaCanHaveThumbnails example
public
function
generate
(
MediaCollection
$collection
, Context
$context
)
: int
{
$delete
=
[
]
;
$generate
=
[
]
;
foreach
(
$collection
as
$media
)
{
if
(
$media
->
getThumbnails
(
)
=== null
)
{
throw
MediaException::
thumbnailAssociationNotLoaded
(
)
;
}
if
(
!
$this
->
mediaCanHaveThumbnails
(
$media
,
$context
)
)
{
$delete
=
[
...
$delete
, ...
$media
->
getThumbnails
(
)
->
getIds
(
)
]
;
continue
;
}
$mediaFolder
=
$media
->
getMediaFolder
(
)
;
if
(
$mediaFolder
=== null
)
{
continue
;
}
$config
=
$mediaFolder
->
getConfiguration
(
)
;