This is only returning one table, with no joins. I've tried doing the namespaced.* thing for each table, but that doesn't work
$namespaced_table = 'Plc\\'.ucfirst('reports').'\\'.\Phalcon\Text::camelize('report_tools');
$namespaced_table1 = 'Plc\\'.ucfirst('reports').'\\'.\Phalcon\Text::camelize('tools');
$namespaced_table2 = 'Plc\\'.ucfirst('reports').'\\'.\Phalcon\Text::camelize('tool_content');
$namespaced_table3 = 'Plc\\'.ucfirst('reports').'\\'.\Phalcon\Text::camelize('tool_scripts');
$query_object = $this->modelsManager->createBuilder()
->from($namespaced_table)
->leftJoin($namespaced_table1, $namespaced_table.'.tool_id=t.id', 't')
->leftJoin($namespaced_table2, 'tc.tool_id=t.id', 'tc')
->leftJoin($namespaced_table3, 'ts.tool_id=t.id', 'ts')
->where($namespaced_table.'.report_id = 209');
SQL output:
SELECT `report_tools` FROM `reports_alpha`.`report_tools` LEFT JOIN `reports_alpha`.`tools` AS `t` ON `report_tools`.`tool_id` = `t`.`id` LEFT JOIN `reports_alpha`.`tool_content` AS `tc` ON `tc`.`tool_id` = `t`.`id` LEFT JOIN `reports_alpha`.`tool_scripts` AS `ts` ON `ts`.`tool_id` = `t`.`id` WHERE `report_tools`.`report_id` = 209
report_tools
replaced with * is valid SQL
When I alter to (columns, multi-table *)
$query_object = $this->modelsManager->createBuilder()
->from($namespaced_table)
->columns(array($namespaced_table.'.*',$namespaced_table2.'.*'))
->leftJoin($namespaced_table1, $namespaced_table.'.tool_id=t.id', 't')
->leftJoin($namespaced_table2, 'tc.tool_id=t.id', 'tc')
->leftJoin($namespaced_table3, 'ts.tool_id=t.id', 'ts')
->where($namespaced_table.'.report_id = 209');
I get
Fatal error: Uncaught exception 'Phalcon\Mvc\Model\Exception' with message 'Unknown model or alias 'Plc\Reports\Tools' (2), when preparing: SELECT...
I did a successful stand alone SELECT on 'Plc\Reports\Tools', so I know that the model etc is good.
Suggestions?