Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
fetchIntegrationIdOfAssociatedApp example
$integrationId
=
$this
->
getIntegrationId
(
$context
)
;
$violationList
=
new
ConstraintViolationList
(
)
;
foreach
(
$event
->
getCommands
(
)
as
$command
)
{
if
(
!
(
$command
->
getDefinition
(
)
instanceof CustomFieldSetDefinition
)
||
$command
instanceof InsertCommand
)
{
continue
;
}
$appIntegrationId
=
$this
->
fetchIntegrationIdOfAssociatedApp
(
$command
)
;
if
(
!
$appIntegrationId
)
{
continue
;
}
if
(
$integrationId
!==
$appIntegrationId
)
{
$this
->
addViolation
(
$violationList
,
$command
)
;
}
}
if
(
$violationList
->
count
(
)
> 0
)
{
$event
->
getExceptions
(
)
->
add
(
new
WriteConstraintViolationException
(
$violationList
)
)
;
}
}