Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
orderDeliveryNotFound example
$criteria
=
new
Criteria
(
[
$orderDeliveryId
]
)
;
$criteria
->
addAssociation
(
'order.orderCustomer'
)
;
$criteria
->
addAssociation
(
'order.transactions.stateMachineState'
)
;
/** @var OrderDeliveryEntity|null $orderDelivery */
$orderDelivery
=
$this
->deliveryRepository
->
search
(
$criteria
,
$event
->
getContext
(
)
)
->
first
(
)
;
if
(
$orderDelivery
=== null
)
{
throw
OrderException::
orderDeliveryNotFound
(
$orderDeliveryId
)
;
}
if
(
$orderDelivery
->
getOrder
(
)
=== null
)
{
throw
OrderException::
orderDeliveryNotFound
(
$orderDeliveryId
)
;
}
$context
=
$this
->
getContext
(
$orderDelivery
->
getOrderId
(
)
,
$event
->
getContext
(
)
)
;
$order
=
$this
->
getOrder
(
$orderDelivery
->
getOrderId
(
)
,
$context
)
;
$this
->
dispatchEvent
(
$event
->
getStateEventName
(
)
,
$order
,
$context
)
;
}