Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getInheritanceViolations example
public
function
postValidate
(
PostWriteValidationEvent
$event
)
: void
{
$commands
=
$event
->
getCommands
(
)
;
$affectedIds
=
$this
->
getAffectedIds
(
$commands
)
;
if
(
\
count
(
$affectedIds
)
=== 0
)
{
return
;
}
$violations
=
new
ConstraintViolationList
(
)
;
$violations
->
addAll
(
$this
->
getInheritanceViolations
(
$affectedIds
)
)
;
$violations
->
addAll
(
$this
->
getMissingTranslationCodeViolations
(
$affectedIds
)
)
;
if
(
$violations
->
count
(
)
> 0
)
{
$event
->
getExceptions
(
)
->
add
(
new
WriteConstraintViolationException
(
$violations
)
)
;
}
}
public
function
preValidate
(
PreWriteValidationEvent
$event
)
: void
{
$commands
=
$event
->
getCommands
(
)
;