Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
copyConfigurationTemplateTranslations example
if
(
$existentDetailModel
)
{
$detail
=
$product
->
getMainDetail
(
)
;
}
else
{
$detail
=
new
ProductVariant
(
)
;
$this
->
get
(
'models'
)
->
persist
(
$detail
)
;
}
$detail
->
fromArray
(
$data
)
;
$detail
->
setArticle
(
$product
)
;
$this
->
get
(
'models'
)
->
flush
(
)
;
$this
->
copyConfigurationTemplateTranslations
(
$detailData
,
$detail
)
;
++
$offset
;
}
$this
->
get
(
'models'
)
->
clear
(
)
;
$product
=
$this
->
getRepository
(
)
->
find
(
$productId
)
;
if
(
!
$product
instanceof Product
)
{
throw
new
ModelNotFoundException
(
Product::
class
,
$productId
)
;
}
// Check if the main detail variant was deleted