Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
deleteVariantsForAllDeactivatedOptions example
if
(
!
$product
instanceof Product
)
{
throw
new
ModelNotFoundException
(
Product::
class
,
$productId
)
;
}
$generatorData
=
$this
->
prepareGeneratorData
(
$groups
,
$offset
,
$limit
)
;
$detailData
=
$this
->
getDetailDataForVariantGeneration
(
$product
)
;
if
(
$offset
=== 0 &&
$mergeType
=== 1
)
{
$this
->
removeAllConfiguratorVariants
(
$productId
)
;
}
elseif
(
$offset
=== 0 &&
$mergeType
=== 2
)
{
$this
->
deleteVariantsForAllDeactivatedOptions
(
$product
,
$generatorData
[
'allOptions'
]
)
;
}
$this
->
get
(
'models'
)
->
clear
(
)
;
$product
=
$this
->
getRepository
(
)
->
find
(
$productId
)
;
if
(
!
$product
instanceof Product
)
{
throw
new
ModelNotFoundException
(
Product::
class
,
$productId
)
;
}
$detailData
=
$this
->
setDetailDataReferences
(
$detailData
,
$product
)
;
$configuratorSet
=
$product
->
getConfiguratorSet
(
)
;
if
(
!
$configuratorSet
instanceof Set
)
{