Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
ShopModel example
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
(
)
;
return
$shop
;
}