Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setIncludeDeliveries example
$this
->
validateOrder
(
$order
,
$orderId
)
;
\
assert
(
$order
instanceof OrderEntity
)
;
$salesChannelContext
=
$this
->orderConverter->
assembleSalesChannelContext
(
$order
,
$context
)
;
$cart
=
$this
->orderConverter->
convertToCart
(
$order
,
$context
)
;
$recalculatedCart
=
$this
->
recalculateCart
(
$cart
,
$salesChannelContext
)
;
$conversionContext
=
(
new
OrderConversionContext
(
)
)
->
setIncludeCustomer
(
false
)
->
setIncludeBillingAddress
(
false
)
->
setIncludeDeliveries
(
true
)
->
setIncludeTransactions
(
false
)
->
setIncludeOrderDate
(
false
)
;
$orderData
=
$this
->orderConverter->
convertToOrder
(
$recalculatedCart
,
$salesChannelContext
,
$conversionContext
)
;
$orderData
[
'id'
]
=
$order
->
getId
(
)
;
$orderData
[
'stateId'
]
=
$order
->
getStateId
(
)
;
if
(
$order
->
getDeliveries
(
)
?->
first
(
)
?->
getStateId
(
)
)
{
$orderData
[
'deliveries'
]
[
0
]
[
'stateId'
]
=
$order
->
getDeliveries
(
)
->
first
(
)
->
getStateId
(
)
;
}
// change scope to be able to write protected state fields of transactions and deliveries