$defaultSort =
['0' =>
['property' => 'orderTime', 'direction' => 'DESC'
]];
$limit =
(int) $this->
Request()->
getParam('limit', 20
);
$offset =
(int) $this->
Request()->
getParam('start', 0
);
$sort =
$this->
Request()->
getParam('sort',
$defaultSort);
$filter =
$this->
Request()->
getParam('filter'
);
$filter =
$filter[0
]['value'
];
// Get access on the customer getRepository()
$query =
$this->
getRepository()->
getOrdersQuery($customerId,
$filter,
$sort,
$limit,
$offset);
// Returns the total count of the query
$totalResult =
$this->
getManager()->
getQueryCount($query);
// Returns the customer data
$orders =
$query->
getArrayResult();
$this->
View()->
assign(['success' => true, 'data' =>
$orders, 'total' =>
$totalResult]);
} /**
* Event listener method which fires when the detail page of a customer is loaded.
* Returns an array of grouped order data to display them in a line chart.
*/