Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
CreditNoteOrdersEvent example
$orders
->
add
(
$order
)
;
$operation
->
setReferencedDocumentId
(
$invoice
[
'id'
]
)
;
if
(
$order
->
getVersionId
(
)
)
{
$operation
->
setOrderVersionId
(
$order
->
getVersionId
(
)
)
;
}
}
catch
(
\Throwable
$exception
)
{
$result
->
addError
(
$operation
->
getOrderId
(
)
,
$exception
)
;
}
}
$this
->eventDispatcher->
dispatch
(
new
CreditNoteOrdersEvent
(
$orders
,
$context
,
$operations
)
)
;
foreach
(
$orders
as
$order
)
{
$orderId
=
$order
->
getId
(
)
;
try
{
$operation
=
$operations
[
$orderId
]
?? null;
if
(
$operation
=== null
)
{
continue
;
}