Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createElements example
foreach
(
$data
[
'shops'
]
as
$shop
)
{
$subShop
=
$this
->
get
(
'models'
)
->
find
(
Shop::
class
,
$shop
[
'id'
]
)
;
if
(
$shop
!== null
)
{
$shops
->
add
(
$subShop
)
;
}
}
}
$elements
=
[
]
;
if
(
!
empty
(
$data
[
'elements'
]
)
)
{
$elements
=
$this
->
createElements
(
$emotion
,
$data
[
'elements'
]
)
;
}
if
(
Shopware
(
)
->
Container
(
)
->
get
(
'auth'
)
->
getIdentity
(
)
->id
)
{
$user
=
$this
->
get
(
'models'
)
->
find
(
User::
class
,
Shopware
(
)
->
Container
(
)
->
get
(
'auth'
)
->
getIdentity
(
)
->id
)
;
$emotion
->
setUser
(
$user
)
;
}
$emotion
->
setModified
(
new
DateTime
(
)
)
;
$emotion
->
setName
(
$data
[
'name'
]
)
;
$emotion
->
setValidFrom
(
$validFrom
)
;
$emotion
->
setValidTo
(
$validTo
)
;