Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setAge example
$customer
->
setSalutation
(
$data
[
'__customer_salutation'
]
)
;
$customer
->
setFirstname
(
$data
[
'__customer_firstname'
]
)
;
$customer
->
setLastname
(
$data
[
'__customer_lastname'
]
)
;
$customer
->
setNumber
(
$data
[
'__customer_customernumber'
]
)
;
$customer
->
setNewsletter
(
(bool)
$data
[
'__active_campaign'
]
)
;
if
(
$data
[
'__customer_birthday'
]
)
{
$customer
->
setBirthday
(
new
DateTime
(
$data
[
'__customer_birthday'
]
)
)
;
}
if
(
$customer
->
getBirthday
(
)
)
{
$customer
->
setAge
(
$customer
->
getBirthday
(
)
->
diff
(
new
DateTime
(
)
)
->y
)
;
}
if
(
!
empty
(
$data
[
'__customer_lockeduntil'
]
)
)
{
$customer
->
setLockedUntil
(
new
DateTime
(
$data
[
'__customer_lockeduntil'
]
)
)
;
}
if
(
!
empty
(
$data
[
'__customer_firstlogin'
]
)
)
{
$customer
->
setFirstLogin
(
new
DateTime
(
$data
[
'__customer_firstlogin'
]
)
)
;
}
if
(
!
empty
(
$data
[
'__customer_lastlogin'
]
)
)
{
$customer
->
setLastLogin
(
new
DateTime
(
$data
[
'__customer_lastlogin'
]
)
)
;
}