Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
fetchOrderLineItemsForOrder example
return
;
}
if
(
$event
->
getEntityName
(
)
!== 'order'
)
{
return
;
}
if
(
$event
->
getFromPlace
(
)
->
getTechnicalName
(
)
=== OrderStates::STATE_CANCELLED
)
{
$this
->stockStorage->
alter
(
array_map
(
fn
(
array
$item
)
=>
$this
->
changeset
(
$item
[
'id'
]
,
$item
[
'product_id'
]
, 0,
(int)
$item
[
'quantity'
]
)
,
$this
->
fetchOrderLineItemsForOrder
(
$event
->
getEntityId
(
)
)
)
,
$event
->
getContext
(
)
)
;
return
;
}
if
(
$event
->
getToPlace
(
)
->
getTechnicalName
(
)
=== OrderStates::STATE_CANCELLED
)
{
$this
->stockStorage->
alter
(
array_map
(
fn
(
array
$item
)
=>
$this
->
changeset
(
$item
[
'id'
]
,
$item
[
'product_id'
]
,
(int)
$item
[
'quantity'
]
, 0
)
,