Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getMergeableTranslationPayload example
private
function
getMergedWriteResult
(
EntityWrittenEvent
$translationEvent
,
EntityWriteResult
$writeResult
)
: ?EntityWriteResult
{
$translationResults
=
$this
->
findWriteResultByPrimaryKey
(
$translationEvent
->
getWriteResults
(
)
,
$writeResult
->
getPrimaryKey
(
)
)
;
$payload
=
$writeResult
->
getPayload
(
)
;
foreach
(
$translationResults
as
$translationResult
)
{
$payload
=
array_merge
(
$payload
,
$this
->
getMergeableTranslationPayload
(
$translationResult
)
)
;
}
if
(
empty
(
$payload
)
)
{
return
null;
}
return
new
EntityWriteResult
(
$writeResult
->
getPrimaryKey
(
)
,
$payload
,
$writeResult
->
getEntityName
(
)
,
$writeResult
->
getOperation
(
)
,