Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getConfirmationByHashQuery example
$blogArticleId
=
(int)
$this
->
Request
(
)
->
getParam
(
'blogArticle'
)
;
$sErrorFlag
=
[
]
;
if
(
!
empty
(
$blogArticleId
)
)
{
$blogArticleQuery
=
$this
->
getRepository
(
)
->
getDetailQuery
(
$blogArticleId
,
$this
->
get
(
'shop'
)
->
getId
(
)
)
;
$blogArticleData
=
$blogArticleQuery
->
getOneOrNullResult
(
AbstractQuery::HYDRATE_ARRAY
)
;
$this
->
View
(
)
->
assign
(
'sAction',
$this
->
Request
(
)
->
getActionName
(
)
)
;
if
(
$hash
=
$this
->
Request
(
)
->sConfirmation
)
{
// Customer confirmed the link in the mail
$commentConfirmQuery
=
$this
->
getCommentConfirmRepository
(
)
->
getConfirmationByHashQuery
(
$hash
)
;
$getComment
=
$commentConfirmQuery
->
getOneOrNullResult
(
)
;
if
(
$getComment
)
{
$commentData
=
unserialize
(
$getComment
->
getData
(
)
,
[
'allowed_classes' => false
]
)
;
// Delete the data in the s_core_optin table. We don't need it anymore
$this
->
get
(
'models'
)
->
remove
(
$getComment
)
;
$this
->
get
(
'models'
)
->
flush
(
)
;
$this
->
sSaveComment
(
$commentData
,
$blogArticleId
)
;