Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
PaymentMethodRouteResponse example
$salesChannel
,
new
CurrencyEntity
(
)
,
new
CustomerGroupEntity
(
)
,
new
TaxCollection
(
)
,
new
PaymentMethodEntity
(
)
,
new
ShippingMethodEntity
(
)
,
new
ShippingLocation
(
new
CountryEntity
(
)
, null, null
)
,
new
CustomerEntity
(
)
,
new
CashRoundingConfig
(
1, 1.1, true
)
,
new
CashRoundingConfig
(
1, 1.1, true
)
)
;
$this
->response =
new
PaymentMethodRouteResponse
(
new
EntitySearchResult
(
'entity',
1,
new
PaymentMethodCollection
(
)
,
null,
new
Criteria
(
)
,
Context::
createDefaultContext
(
)
)
)
;
$this
->cachedRoute =
new
CachedPaymentMethodRoute
(
$salesChannel
,
new
CurrencyEntity
(
)
,
new
CustomerGroupEntity
(
)
,
new
TaxCollection
(
)
,
$paymentMethod
,
new
ShippingMethodEntity
(
)
,
new
ShippingLocation
(
new
CountryEntity
(
)
, null, null
)
,
new
CustomerEntity
(
)
,
new
CashRoundingConfig
(
1, 1.1, true
)
,
new
CashRoundingConfig
(
1, 1.1, true
)
,
)
;
$this
->response =
new
PaymentMethodRouteResponse
(
new
EntitySearchResult
(
'entity',
1,
new
PaymentMethodCollection
(
[
$paymentMethod
]
)
,
null,
new
Criteria
(
)
,
Context::
createDefaultContext
(
)
)
)
;
$this
->sortedRoute =
new
SortedPaymentMethodRoute
(
$this
->decorated,
$this
->executor
)
;
}
$result
=
$this
->paymentMethodRepository->
search
(
$criteria
,
$context
)
;
$paymentMethods
=
$result
->
getEntities
(
)
;
if
(
$request
->query->
getBoolean
(
'onlyAvailable'
)
||
$request
->request->
getBoolean
(
'onlyAvailable'
)
)
{
$paymentMethods
=
$paymentMethods
->
filterByActiveRules
(
$context
)
;
}
$result
->
assign
(
[
'entities' =>
$paymentMethods
, 'elements' =>
$paymentMethods
, 'total' =>
$paymentMethods
->
count
(
)
]
)
;
return
new
PaymentMethodRouteResponse
(
$result
)
;
}
}
$paymentMethods
=
new
PaymentMethodCollection
(
[
(
new
PaymentMethodEntity
(
)
)
->
assign
(
[
'_uniqueIdentifier' => Uuid::
randomHex
(
)
]
)
,
(
new
PaymentMethodEntity
(
)
)
->
assign
(
[
'_uniqueIdentifier' => Uuid::
randomHex
(
)
]
)
,
]
)
;
$shippingMethods
=
new
ShippingMethodCollection
(
[
(
new
ShippingMethodEntity
(
)
)
->
assign
(
[
'_uniqueIdentifier' => Uuid::
randomHex
(
)
]
)
,
(
new
ShippingMethodEntity
(
)
)
->
assign
(
[
'_uniqueIdentifier' => Uuid::
randomHex
(
)
]
)
,
]
)
;
$paymentMethodResponse
=
new
PaymentMethodRouteResponse
(
new
EntitySearchResult
(
PaymentMethodDefinition::ENTITY_NAME,
2,
$paymentMethods
,
null,
new
Criteria
(
)
,
Context::
createDefaultContext
(
)
)
)
;
$shippingMethodResponse
=
new
ShippingMethodRouteResponse
(