I have 2 tables 'table1' and 'table2' where I'm using $this->Model->query() to fetch the result.
$query = "SELECT T1.firstname, T2.lastname FROM table1 AS T1
LEFT JOIN table2 AS T2 ON T2.fk = T1.pk
WHERE T1.id = 123;";
$result = $this->MyModel->query($query);
The result will have array something like below.
Array
(
[0] => Array
(
[T1] => Array
(
[firstname] => ABC
)
[T2] => Array
(
[lastname] => XYZ
)
)
)
The question is, Can we have the result in single array like either T1 or T2 or any other specific name. Also, Please guide me if we can have the same in CakePHP style.
e.g:
Array
(
[0] => Array
(
[T1] => Array
(
[firstname] => ABC,
[lastname] => XYZ
)
)
)