Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
prepareOrderData example
if
(
empty
(
$id
)
)
{
throw
new
ParameterMissingException
(
'id'
)
;
}
$order
=
$this
->
getRepository
(
)
->
find
(
$id
)
;
if
(
!
$order
)
{
throw
new
NotFoundException
(
sprintf
(
'Order by id %d not found',
$id
)
)
;
}
$params
=
$this
->
prepareOrderData
(
$params
,
$order
)
;
$order
->
fromArray
(
$params
)
;
$violations
=
$this
->
getManager
(
)
->
validate
(
$order
)
;
if
(
$violations
->
count
(
)
> 0
)
{
throw
new
ValidationException
(
$violations
)
;
}
$this
->
flush
(
)
;
return
$order
;
}