Hi I have the following code:
$order = $this->modelsManager
->createBuilder()
->columns([
'order.id',
'order.price',
'order.userid',
'products.id' as pid,
])
->from(['order' => 'Orders'])
->innerJoin('Products', 'order.productid = products.id', 'products')
->where(
'order.id = :order_number:',
['order_number' => $request->getPost('order_number')]
)
->limit(1)
->getQuery()
->execute()
->toArray();
var_dump($order);exit();
Which outputs:
array(1) { [0]=> array(4) { ["id"]=> string(1) "1" ["price"]=> string(6) "12.01" ["userid"]=> string(2) "10" ["countryid"]=> string(3) "225" ["pid"]=> string(1) "2" } }
The output above is an array of an array, I wanted the $order to output:
array(4) { ["id"]=> string(1) "1" ["price"]=> string(6) "12.01" ["userid"]=> string(2) "10" ["countryid"]=> string(3) "225" ["pid"]=> string(1) "2" }
I want to find out why this happens as I would like to be consistent during development.
Thanks