Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setCountryState example
$country
->
setName
(
'Germany'
)
;
}
if
(
!
$state
)
{
$state
=
new
CountryStateEntity
(
)
;
$state
->
setId
(
'bd5e2dcf547e4df6bb1ff58a554bc69e'
)
;
$state
->
setCountryId
(
$country
->
getId
(
)
)
;
}
if
(
!
$shipping
)
{
$shipping
=
new
CustomerAddressEntity
(
)
;
$shipping
->
setCountry
(
$country
)
;
$shipping
->
setCountryState
(
$state
)
;
}
if
(
!
$paymentMethod
)
{
$paymentMethod
=
(
new
PaymentMethodEntity
(
)
)
->
assign
(
[
'id' => '19d144ffe15f4772860d59fca7f207c1',
'handlerIdentifier' => SyncTestPaymentHandler::
class
,
'name' => 'Generated Payment',
'active' => true,
]
)
;
}
private
function
createAddress
(
string
$street
)
: CustomerAddressEntity
{
$address
=
new
CustomerAddressEntity
(
)
;
$state
=
new
CountryStateEntity
(
)
;
$country
=
new
CountryEntity
(
)
;
$state
->
setCountryId
(
'SWAG-AREA-COUNTRY-ID-1'
)
;
$address
->
setStreet
(
$street
)
;
$address
->
setCountry
(
$country
)
;
$address
->
setCountryState
(
$state
)
;
return
$address
;
}
}
$address
=
new
OrderAddressEntity
(
)
;
$address
->
setId
(
'order-address-id'
)
;
$address
->
setSalutationId
(
'order-address-salutation-id'
)
;
$address
->
setFirstName
(
'order-address-first-name'
)
;
$address
->
setLastName
(
'order-address-last-name'
)
;
$address
->
setStreet
(
'order-address-street'
)
;
$address
->
setZipcode
(
'order-address-zipcode'
)
;
$address
->
setCity
(
'order-address-city'
)
;
$address
->
setCountryId
(
'order-address-country-id'
)
;
$address
->
setCountryStateId
(
'order-address-country-state-id'
)
;
$address
->
setCountry
(
$country
)
;
$address
->
setCountryState
(
$countryState
)
;
return
$address
;
}
private
function
getDeliveryCollection
(
bool
$withoutAddress
= false
)
: DeliveryCollection
{
$country
=
new
CountryEntity
(
)
;
$country
->
setId
(
'country-id'
)
;
$country
->
setName
(
'country-name'
)
;
$countryState
=
new
CountryStateEntity
(
)
;