Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
removeAttributes example
/** * @param Product $article */
protected
function
removeArticleDetails
(
$article
)
{
$sql
= 'SELECT id FROM s_articles_details WHERE articleID = ? AND kind != 1';
$details
=
Shopware
(
)
->
Db
(
)
->
fetchAll
(
$sql
,
[
$article
->
getId
(
)
]
)
;
foreach
(
$details
as
$detail
)
{
$this
->
removeAttributes
(
$detail
[
'id'
]
)
;
$query
=
$this
->
getRepository
(
)
->
getRemoveImageQuery
(
$detail
[
'id'
]
)
;
$query
->
execute
(
)
;
$sql
= 'DELETE FROM s_article_configurator_option_relations WHERE article_id = ?';
Shopware
(
)
->
Db
(
)
->
query
(
$sql
,
[
$detail
[
'id'
]
]
)
;
$query
=
$this
->
getRepository
(
)
->
getRemoveVariantTranslationsQuery
(
$detail
[
'id'
]
)
;
$query
->
execute
(
)
;
$query
=
$this
->
getRepository
(
)
->
getRemoveDetailQuery
(
$detail
[
'id'
]
)
;