Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
IdStruct example
return
$root
;
}
private
static
function
updateLineItem
(
LineItem
$lineItem
, OrderLineItemEntity
$entity
, string
$id
)
: void
{
$lineItem
->
setId
(
$entity
->
getIdentifier
(
)
)
->
setLabel
(
$entity
->
getLabel
(
)
)
->
setGood
(
$entity
->
getGood
(
)
)
->
setRemovable
(
$entity
->
getRemovable
(
)
)
->
setStackable
(
$entity
->
getStackable
(
)
)
->
setStates
(
$entity
->
getStates
(
)
)
->
addExtension
(
OrderConverter::ORIGINAL_ID,
new
IdStruct
(
$id
)
)
;
if
(
$entity
->
getPayload
(
)
!== null
)
{
$lineItem
->
setPayload
(
$entity
->
getPayload
(
)
)
;
}
if
(
$entity
->
getPrice
(
)
!== null
)
{
$lineItem
->
setPrice
(
$entity
->
getPrice
(
)
)
;
}
if
(
$entity
->
getPriceDefinition
(
)
!== null
)
{
$lineItem
->
setPriceDefinition
(
$entity
->
getPriceDefinition
(
)
)
;
}
if
(
$order
->
getDeliveries
(
)
=== null
)
{
throw
OrderException::
missingAssociation
(
'deliveries'
)
;
}
$cart
=
new
Cart
(
Uuid::
randomHex
(
)
)
;
$cart
->
setPrice
(
$order
->
getPrice
(
)
)
;
$cart
->
setCustomerComment
(
$order
->
getCustomerComment
(
)
)
;
$cart
->
setAffiliateCode
(
$order
->
getAffiliateCode
(
)
)
;
$cart
->
setCampaignCode
(
$order
->
getCampaignCode
(
)
)
;
$cart
->
setSource
(
$order
->
getSource
(
)
)
;
$cart
->
addExtension
(
self::ORIGINAL_ID,
new
IdStruct
(
$order
->
getId
(
)
)
)
;
$orderNumber
=
$order
->
getOrderNumber
(
)
;
if
(
$orderNumber
=== null
)
{
throw
OrderException::
missingOrderNumber
(
$order
->
getId
(
)
)
;
}
$cart
->
addExtension
(
self::ORIGINAL_ORDER_NUMBER,
new
IdStruct
(
$orderNumber
)
)
;
/* NEXT-708 support: - transactions */
$lineItems
= LineItemTransformer::
transformFlatToNested
(
$order
->
getLineItems
(
)
)
;