CakePHP Version: 3.2
I have question, in cakephp 3 document selecting-all-fields-from-a-table
// Only all fields from the articles table including
// a calculated slug field.
$query = $articlesTable->find();
->select([‘slug’ => $query->func()->concat([‘title’, ‘-’, ‘id’])])
->select($articlesTable); // Select all fields from articles
i have query where i have 5-6 table in contain for joining to bring data along with computed field.
now from your document example passing table instance can bring all records along with computed field.
now my question is that for all the joining table how i can bring their data along with computed column.
I tried to pass joining table class instance within select but i am getting error.
SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘Table2.id’ in ‘field list’
to create table classes instance first then have to pass them in select to be able to be able to bring joined table data?
$table2 = TableRegistry::get('Table2'); $query = $this->table1 ->find('all') ->select(['computed_column' => 'A subquery here']) ->select($this->table1) ->select($table2) ->contain(['Table2','Table3','Table4','Table5']) ->where($conditions);