To select from referenced tables, the correct way to do is this:
$oNotOrm->base_table()->select('table_x.*, table_x.table_z.*, table_y.*')->where('base_table.id', $iPageId);
Explanation:
Select is to be called on a Result (think of as a collection of Rows).
When calling:
$oNotOrm->base_table[$iPageId];
The output will be a single
Row. The
Row class doesn't have the
Select function, instead, if you use it, the class will interpret as if it was a reference to a table called
`select`.
I suppose that's because you wouldn't perform a Select in a single Row...
The being so, we change to:
$oNotOrm->base_table()->where('id', $iPageId);
That will return a
Result object accordingly to the conditions. It's just that it will contain a single
Row, but it's still a
Result object and can have a
Select performed on it.
Now we try to specify the desired info:
$oNotOrm->base_table()->select('table_x.*, table_z.*, table_y.*')->where('id', $iPageId);
The problem is that now we have the column
`id` ambiguously on all the tables, so we have to specify which is the one in the condition:
$oNotOrm->base_table()->select('table_x.*, table_z.*, table_y.*')->where('base_table.id', $iPageId);
The problem now is that NotORM will expect `base_table` to have a direct reference to `table_z` while doing the joins. That isn't the case, so we specify who has the reference:
$oNotOrm->base_table()->select('table_x.*, table_x.table_z.*, table_y.*')->where('base_table.id', $iPageId);
And this will finally give us the expected result.