Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getConfiguredThumbnailSizeIds example
if
(
$this
->
thumbnailSizesIds
(
$con
)
!==
[
]
)
{
$this
->
revertMigration
(
$con
)
;
}
static
::
assertCount
(
0,
$this
->
thumbnailSizesIds
(
$con
)
)
;
$productManufacturerFolderConfigurationId
=
$this
->
getProductFolderConfigurationId
(
$con
)
;
static
::
assertNotNull
(
$productManufacturerFolderConfigurationId
)
;
$beforeConfiguredThumbnailSizeIds
=
$this
->
getConfiguredThumbnailSizeIds
(
$con
,
$productManufacturerFolderConfigurationId
)
;
$m
=
new
Migration1687463180ProductMediaThumbnails
(
)
;
$m
->
update
(
$con
)
;
$thumbnailSizeIds
=
$this
->
thumbnailSizesIds
(
$con
)
;
static
::
assertCount
(
1,
$thumbnailSizeIds
)
;
$configuredThumbnailSizes
=
$this
->
getConfiguredThumbnailSizeIds
(
$con
,
$productManufacturerFolderConfigurationId
)
;
static
::
assertCount
(
\
count
(
$beforeConfiguredThumbnailSizeIds
)
+ 1,
$configuredThumbnailSizes
)
;
$m
->
update
(
$con
)
;
}
if
(
\
count
(
$this
->
thumbnailSizesIds
(
$con
)
)
> 1
)
{
$this
->
revertMigration
(
$con
)
;
}
// 1920px is already registered
static
::
assertCount
(
1,
$this
->
thumbnailSizesIds
(
$con
)
)
;
$productManufacturerFolderConfigurationId
=
$this
->
getProductManufacturerFolderConfigurationId
(
$con
)
;
static
::
assertNotNull
(
$productManufacturerFolderConfigurationId
)
;
static
::
assertCount
(
0,
$this
->
getConfiguredThumbnailSizeIds
(
$con
,
$productManufacturerFolderConfigurationId
)
)
;
$m
=
new
Migration1687462843ProductManufacturerMediaThumbnails
(
)
;
$m
->
update
(
$con
)
;
$thumbnailSizeIds
=
$this
->
thumbnailSizesIds
(
$con
)
;
static
::
assertCount
(
3,
$thumbnailSizeIds
)
;
$configuredThumbnailSizes
=
$this
->
getConfiguredThumbnailSizeIds
(
$con
,
$productManufacturerFolderConfigurationId
)
;
static
::
assertCount
(
3,
$configuredThumbnailSizes
)
;
static
::
assertEmpty
(
array_diff
(
$thumbnailSizeIds
,
$configuredThumbnailSizes
)
)
;