Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
validateStream example
$data
=
$this
->
prepareData
(
$data
)
;
$stream
=
new
CustomerStreamEntity
(
)
;
$stream
->
fromArray
(
$data
)
;
$violations
=
$this
->
getManager
(
)
->
validate
(
$stream
)
;
if
(
$violations
->
count
(
)
> 0
)
{
throw
new
ValidationException
(
$violations
)
;
}
$this
->
validateStream
(
$stream
)
;
$this
->
getManager
(
)
->
persist
(
$stream
)
;
$this
->
getManager
(
)
->
flush
(
$stream
)
;
if
(
$index
)
{
$this
->
indexStream
(
$stream
)
;
}
if
(
\
array_key_exists
(
'customers',
$data
)
&&
$stream
->
isStatic
(
)
)
{
$this
->
insertCustomers
(
$data
[
'customers'
]
,
$stream
->
getId
(
)
)
;
}