Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getRemoveImageQuery example
protected
function
removeArticleDetails
(
$article
)
{
$sql
= 'SELECT id FROM s_articles_details WHERE articleID = ? AND kind != 1';
foreach
(
Shopware
(
)
->
Db
(
)
->
fetchAll
(
$sql
,
[
$article
->
getId
(
)
]
)
as
$detail
)
{
$query
=
$this
->
getRepository
(
)
->
getRemoveAttributesQuery
(
$detail
[
'id'
]
)
;
$query
->
execute
(
)
;
$query
=
$this
->
getRepository
(
)
->
getRemoveImageQuery
(
$detail
[
'id'
]
)
;
$query
->
execute
(
)
;
$sql
= 'DELETE FROM s_article_configurator_option_relations WHERE article_id = ?';
$this
->
getManager
(
)
->
getConnection
(
)
->
executeQuery
(
$sql
,
[
$detail
[
'id'
]
]
)
;
$sql
= 'DELETE FROM s_articles_prices WHERE articledetailsID = ?';
$this
->
getManager
(
)
->
getConnection
(
)
->
executeQuery
(
$sql
,
[
$detail
[
'id'
]
]
)
;
$query
=
$this
->
getRepository
(
)
->
getRemoveVariantTranslationsQuery
(
$detail
[
'id'
]
)
;
$query
->
execute
(
)
;
/** * @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'
]
)
;
$query
->
execute
(
)
;
}
}