Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
prepareShopData example
/** * @throws Exception * @throws ValidationException * * @return ShopModel */
public
function
create
(
array
$params
)
{
$this
->
checkPrivilege
(
'create'
)
;
$params
=
$this
->
prepareShopData
(
$params
)
;
$shop
=
new
ShopModel
(
)
;
$shop
->
fromArray
(
$params
)
;
$violations
=
$this
->
getManager
(
)
->
validate
(
$shop
)
;
if
(
$violations
->
count
(
)
> 0
)
{
throw
new
ValidationException
(
$violations
)
;
}
$this
->
getManager
(
)
->
persist
(
$shop
)
;
$this
->
flush
(
)
;