Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getShippingCostsQuery example
$sort
=
$this
->
Request
(
)
->
getParam
(
'sort',
[
[
'property' => 'dispatch.name', 'direction' => 'ASC'
]
]
)
;
$filter
=
$this
->
Request
(
)
->
getParam
(
'filter'
)
;
if
(
\
is_array
(
$filter
)
&&
isset
(
$filter
[
0
]
[
'value'
]
)
)
{
$filter
=
$filter
[
0
]
[
'value'
]
;
}
if
(
$dispatchID
=== null
)
{
$dispatchID
=
$this
->
Request
(
)
->
getParam
(
'id'
)
;
}
$query
=
$this
->
getRepository
(
)
->
getShippingCostsQuery
(
$dispatchID
,
$filter
,
$sort
,
$limit
,
$offset
)
;
$query
->
setHydrationMode
(
AbstractQuery::HYDRATE_ARRAY
)
;
$paginator
=
$this
->
getModelManager
(
)
->
createPaginator
(
$query
)
;
// Returns the total count of the query
$totalResult
=
$paginator
->
count
(
)
;
$shippingCosts
=
iterator_to_array
(
$paginator
)
;
$shippingCosts
=
$this
->
convertShippingCostsDates
(
$shippingCosts
)
;
if
(
$totalResult
> 0
)
{
$shippingCosts
=
$this
->
translateDispatchMethods
(
$shippingCosts
)
;
}