Hi guys, I'm learning to use the Builder and so far I've been using it to paginate stuff and it works great. However, now I don't need to paginate, I need to put every row returned into an array (later to export it to an Excel file) and I haven't been able to manipulate the Builder results in order to do this.
Here's my code:
$columnsSt = 'Customers.partner_id, Customers.customer_id, account_type, merge, DATE_FORMAT(MAX(date), "%d-%m-%Y") as lastdate';
$customers = $this->modelsManager->createBuilder()
->columns($columnsSt)
->from('Customers')
->leftJoin('Purchases', 'Customers.customer_id = p.customer_id','p')
->groupBy(array('Customers.customer_id'))
->orderBy('customer_id DESC');
As I mentioned, if I use the paginator, I can display this info on my page without problem:
$paginator = new PaginatorQueryBuilder(array(
"builder" => $customers,
"limit" => 20,
"page" => $this->request->getQuery('page', 'int')
));
However, now I don't want to paginate! I want to put every result of the Builder into an array. Something like this:
foreach($customers as $cust)
{
$CustArr[] = array(
'partner_id' => $cust->partner_id,
'account_type' => $cust->account_type,
'lastdate' => $cust->lastdate,
);
}
So my question is: how can I manipulate the results of the Builder in order to place them in an array? I'm sorry if this is too dumb, but I haven't been able to do this. Thank you so much!