Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setCreateDate example
$emotion
->
setCellHeight
(
(int)
$data
[
'__emotion_cell_height'
]
)
;
$emotion
->
setArticleHeight
(
(int)
$data
[
'__emotion_article_height'
]
)
;
$emotion
->
setRows
(
(int)
$data
[
'__emotion_rows'
]
)
;
$emotion
->
setValidFrom
(
$this
->
createDate
(
$data
[
'__emotion_valid_from'
]
)
)
;
$emotion
->
setValidTo
(
$this
->
createDate
(
$data
[
'__emotion_valid_to'
]
)
)
;
$emotion
->
setUserId
(
(int)
$data
[
'__emotion_user_id'
]
)
;
$emotion
->
setShowListing
(
(bool)
$data
[
'__emotion_show_listing'
]
)
;
$emotion
->
setIsLandingPage
(
(bool)
$data
[
'__emotion_is_landingpage'
]
)
;
$emotion
->
setSeoTitle
(
$data
[
'__emotion_seo_title'
]
)
;
$emotion
->
setSeoKeywords
(
$data
[
'__emotion_seo_keywords'
]
)
;
$emotion
->
setSeoDescription
(
$data
[
'__emotion_seo_description'
]
)
;
$emotion
->
setCreateDate
(
$this
->
createDate
(
$data
[
'__emotion_create_date'
]
)
)
;
$emotion
->
setModifiedDate
(
$this
->
createDate
(
$data
[
'__emotion_modified'
]
)
)
;
$emotion
->
setTemplateId
(
(int)
$data
[
'__emotion_template_id'
]
)
;
$emotion
->
setDevices
(
array_map
(
'\intval',
explode
(
',',
$data
[
'__emotion_device'
]
)
)
)
;
$emotion
->
setFullscreen
(
(bool)
$data
[
'__emotion_fullscreen'
]
)
;
$emotion
->
setMode
(
$data
[
'__emotion_mode'
]
)
;
$emotion
->
setPosition
(
(int)
$data
[
'__emotion_position'
]
)
;
$emotion
->
setParentId
(
$data
[
'__emotion_parent_id'
]
!== null ?
(int)
$data
[
'__emotion_parent_id'
]
: null
)
;
$emotion
->
setIsPreview
(
(bool)
$data
[
'__emotion_preview_id'
]
)
;
$emotion
->
setPreviewSecret
(
$data
[
'__emotion_preview_secret'
]
)
;
$emotion
->
setCategoryIds
(
array_map
(
'\intval',
explode
(
',',
$data
[
'__emotion_category_ids'
]
)
)
)
;
$emotion
->
setShopIds
(
array_map
(
'\intval',
explode
(
',',
$data
[
'__emotion_shop_ids'
]
)
)
)
;
$new
->
setParentId
(
$emotion
->
getParentId
(
)
)
;
break
;
case
$emotion
->
getIsLandingPage
(
)
:
$new
->
setParentId
(
$emotion
->
getId
(
)
)
;
break
;
}
$copyName
=
$emotion
->
getName
(
)
. ' - Copy';
$new
->
setName
(
$copyName
)
;
$new
->
setDevice
(
$device
)
;
$new
->
setCreateDate
(
new
DateTime
(
)
)
;
$new
->
setModified
(
new
DateTime
(
)
)
;
$this
->
get
(
'models'
)
->
persist
(
$new
)
;
$this
->
get
(
'models'
)
->
flush
(
)
;
if
(
!
empty
(
$new
->
getId
(
)
)
)
{
$this
->
copyEmotionTranslations
(
(int)
$emotion
->
getId
(
)
,
(int)
$new
->
getId
(
)
)
;
$this
->
copyElementTranslations
(
$emotion
,
$new
)
;
$persister
=
Shopware
(
)
->
Container
(
)
->
get
(
DataPersister::
class
)
;
$persister
->
cloneAttribute
(
's_emotion_attributes',
$emotion
->
getId
(
)
,
$new
->
getId
(
)
)
;
}