suppose I do
$resultset = $this->getDi()->get('modelsManager')->executeQuery("
SELECT a.*, b.image FROM ModelA a LEFT JOIN ModelB b
");
foreach ($resultset as $row) {
var_dump($row);
}
I get:
array (size=2)
'a' => object(ModelA)
protected 'col1' => string 'col1val',
protected 'col2' => string 'col2val',
...
'image' => string 'imgval'
However I need to pass this to a view:
array(
'col1'=>'col1val',
'col2'=>'col2val',
...
'image'=>'imgval'
)
I can pre process the data to force it into the new format but then the data is looped though twice, once for the prep and once for the view output.
Or I could just do $resultset = ModelA::find()
and force the guy who does the views to understand database table relationships to get the ModelB::image
per row however this requires the frontend guy to learn things he shouldn't have to know and would result in many extra queries being executed (one per row) than should be required.
Is there not a way to get a simple combined resultset from a multi table query?
I understand the value in that this way I could make changes to a
and save .. but in this case I only want to output data.