Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
resolveExtJsData example
public
function
save
(
$data
)
{
$model
=
$this
->
getRepository
(
)
->
find
(
(int)
(
$data
[
'id'
]
?? 0
)
)
;
if
(
$model
=== null
)
{
$model
=
new
$this
->
model
(
)
;
$this
->
getManager
(
)
->
persist
(
$model
)
;
}
$data
=
$this
->
resolveExtJsData
(
$data
)
;
$model
->
fromArray
(
$data
)
;
$violations
=
$this
->
getManager
(
)
->
validate
(
$model
)
;
$errors
=
[
]
;
foreach
(
$violations
as
$violation
)
{
$errors
[
]
=
[
'message' =>
$violation
->
getMessage
(
)
,
'property' =>
$violation
->
getPropertyPath
(
)
,
]
;
}