Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setCreationDate example
$licence
->
setLabel
(
$row
[
'description'
]
)
;
$licence
->
setTechnicalName
(
$row
[
'plugin'
]
[
'name'
]
)
;
$licence
->
setShop
(
$row
[
'shop'
]
)
;
if
(
$row
[
'domain'
]
)
{
$licence
->
setShop
(
$row
[
'domain'
]
)
;
}
$licence
->
setIconPath
(
$row
[
'plugin'
]
[
'iconPath'
]
)
;
if
(
isset
(
$row
[
'creationDate'
]
)
)
{
$date
=
new
DateTime
(
$row
[
'creationDate'
]
)
;
$licence
->
setCreationDate
(
$date
)
;
}
$subscription
= null;
if
(
isset
(
$row
[
'subscription'
]
)
)
{
$subscription
=
$row
[
'subscription'
]
;
$licence
->
setSubscription
(
$subscription
[
'type'
]
[
'name'
]
)
;
}
if
(
isset
(
$subscription
)
&&
$subscription
[
'expirationDate'
]
)
{
$date
=
new
DateTime
(
$subscription
[
'expirationDate'
]
)
;
protected
?array
$discountInformation
= null;
/** * @param array<string, mixed> $data */
public
static
function
fromArray
(
array
$data
)
: LicenseStruct
{
$license
=
(
new
self
(
)
)
->
assign
(
$data
)
;
if
(
isset
(
$data
[
'creationDate'
]
)
&& \
is_string
(
$data
[
'creationDate'
]
)
)
{
$license
->
setCreationDate
(
new
\
DateTimeImmutable
(
$data
[
'creationDate'
]
)
)
;
}
if
(
isset
(
$data
[
'nextBookingDate'
]
)
&& \
is_string
(
$data
[
'nextBookingDate'
]
)
)
{
$license
->
setNextBookingDate
(
new
\
DateTimeImmutable
(
$data
[
'nextBookingDate'
]
)
)
;
}
return
$license
;
}
public
function
getId
(
)
: int
{
if
(
!
empty
(
Shopware
(
)
->
Config
(
)
->sOPTINVOTE
)
&&
(
empty
(
$this
->
Request
(
)
->eMail
)
|| !
$validator
->
isValid
(
$this
->
Request
(
)
->eMail
)
)
)
{
$sErrorFlag
[
'eMail'
]
= true;
}
}
if
(
empty
(
$sErrorFlag
)
)
{
if
(
!
empty
(
Shopware
(
)
->
Config
(
)
->sOPTINVOTE
)
&&
empty
(
Shopware
(
)
->
Session
(
)
->
get
(
'sUserId'
)
)
)
{
$hash
= Random::
getAlphanumericString
(
32
)
;
// Save comment confirm for the optin
$blogCommentModel
=
new
CommentConfirm
(
)
;
$blogCommentModel
->
setCreationDate
(
new
DateTime
(
'now'
)
)
;
$blogCommentModel
->
setHash
(
$hash
)
;
$blogCommentModel
->
setData
(
serialize
(
$this
->
Request
(
)
->
getPost
(
)
)
)
;
$this
->
get
(
'models'
)
->
persist
(
$blogCommentModel
)
;
$this
->
get
(
'models'
)
->
flush
(
)
;
$link
=
$this
->
Front
(
)
->
ensureRouter
(
)
->
assemble
(
[
'sViewport' => 'blog', 'action' => 'rating', 'blogArticle' =>
$blogArticleId
, 'sConfirmation' =>
$hash
]
)
;
$context
=
[
'sConfirmLink' =>
$link
, 'sArticle' =>
[
'title' =>
$blogArticleData
[
'title'
]
]
]
;
$mail
=
Shopware
(
)
->
TemplateMail
(
)
->
createMail
(
'sOPTINBLOGCOMMENT',
$context
)
;
$mail
->
addTo
(
$this
->
Request
(
)
->
getParam
(
'eMail'
)
)
;