Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getDispatchesQuery example
if
(
!\
in_array
(
$this
->
Request
(
)
->
getActionName
(
)
,
[
'index', 'load', 'validateEmail'
]
)
)
{
$this
->
Front
(
)
->
Plugins
(
)
->
Json
(
)
->
setRenderer
(
true
)
;
}
}
public
function
loadStoresAction
(
)
{
$orderStatus
=
$this
->
getOrderRepository
(
)
->
getOrderStatusQuery
(
)
->
getArrayResult
(
)
;
$paymentStatus
=
$this
->
getOrderRepository
(
)
->
getPaymentStatusQuery
(
)
->
getArrayResult
(
)
;
$payment
=
$this
->
getPaymentRepository
(
)
->
getAllPaymentsQuery
(
)
->
getArrayResult
(
)
;
$dispatch
=
$this
->
getDispatchRepository
(
)
->
getDispatchesQuery
(
)
->
getArrayResult
(
)
;
$shop
=
$this
->
getShopRepository
(
)
->
getBaseListQuery
(
)
->
getArrayResult
(
)
;
$country
=
$this
->
getCountryRepository
(
)
->
getCountriesQuery
(
)
->
getArrayResult
(
)
;
$customerGroups
=
$this
->
getRepository
(
)
->
getCustomerGroupsQuery
(
)
->
getArrayResult
(
)
;
/** @var StateTranslatorServiceInterface $stateTranslator */
$stateTranslator
=
$this
->
get
(
'shopware.components.state_translator'
)
;
$orderStatus
=
array_map
(
function
D
$orderStateItem
)
use
(
$stateTranslator
)
{
return
$stateTranslator
->
translateState
(
StateTranslatorService::STATE_ORDER,
$orderStateItem
)
;
}
,
$orderStatus
)
;
$paymentStatus
=
array_map
(
function
D
$paymentStateItem
)
use
(
$stateTranslator
)
{
public
function
getDispatchesAction
(
)
{
// Load shop repository
$repository
=
$this
->
get
(
'models'
)
->
getRepository
(
Dispatch::
class
)
;
$query
=
$repository
->
getDispatchesQuery
(
$this
->
Request
(
)
->
getParam
(
'filter',
[
]
)
,
$this
->
Request
(
)
->
getParam
(
'sort',
[
]
)
,
$this
->
Request
(
)
->
getParam
(
'start'
)
,
$this
->
Request
(
)
->
getParam
(
'limit'
)
)
;
// Get total result of the query
$total
=
$this
->
get
(
'models'
)
->
getQueryCount
(
$query
)
;
// Select all shop as array
$data
=
$query
->
getArrayResult
(
)
;
'direction' => 'DESC',
]
,
[
'property' => 'countries.name',
'direction' => 'ASC',
]
,
]
;
$shops
=
$this
->
getShopRepository
(
)
->
getBaseListQuery
(
)
->
getArrayResult
(
)
;
$countries
=
$this
->
getCountryRepository
(
)
->
getCountriesQuery
(
null,
$countriesSort
)
->
getArrayResult
(
)
;
$payments
=
$this
->
getPaymentRepository
(
)
->
getAllPaymentsQuery
(
)
->
getArrayResult
(
)
;
$dispatches
=
$this
->
getDispatchRepository
(
)
->
getDispatchesQuery
(
)
->
getArrayResult
(
)
;
$documentTypes
=
$this
->
getRepository
(
)
->
getDocumentTypesQuery
(
)
->
getArrayResult
(
)
;
// Translate objects
$translationComponent
=
$this
->
get
(
Shopware_Components_Translation::
class
)
;
$payments
=
$translationComponent
->
translatePaymentMethods
(
$payments
)
;
$documentTypes
=
$translationComponent
->
translateDocuments
(
$documentTypes
)
;
$dispatches
=
$translationComponent
->
translateDispatchMethods
(
$dispatches
)
;
$this
->
View
(
)
->
assign
(
[
'success' => true,
'data' =>
[