Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getClone example
return
;
}
$result
=
$this
->
getRepository
(
)
->
find
(
$id
)
;
if
(
!
$result
instanceof Form
)
{
$this
->
View
(
)
->
assign
(
[
'success' => false, 'message' => 'Form not found'
]
)
;
return
;
}
$clonedForm
=
$result
->
getClone
(
)
;
$clonedForm
->
setName
(
'Copy of ' .
$result
->
getName
(
)
)
;
$this
->
getManager
(
)
->
persist
(
$clonedForm
)
;
$this
->
getManager
(
)
->
flush
(
)
;
$persister
=
Shopware
(
)
->
Container
(
)
->
get
(
DataPersister::
class
)
;
$persister
->
cloneAttribute
(
's_cms_support_attributes',
$id
,
$clonedForm
->
getId
(
)
)
;
$this
->
View
(
)
->
assign
(
[
'success' => true
]
)
;
}