Hello, im new using cakephp so i dont know so much about the framework, as tittle says im trying to sort a result of a get method, also my get query is made with multiple associations and i want to sort a sub-associated content.
I have already done it, i just added “‘sort’ => ‘“field” ASC’” on my associated model table.
What does your code look like? Does it match this expample?
No, that form doesnt work with ‘get’
'foreignKey' => 'idTable', 'sort' => 'Table.idTable ASC' ]);
this is done in my associated table
what kind of result are you getting? unsorted data? no data? an error?
im calling data from some associations of associations ex:
$query = $this->myModel->get($id, [
'contain' => ['table' => ['table_2', 'table3'], 'table4', 'SvcDetordenes' ...]]], ]);
and it sorts the results returned from the association i specified to sort data.
I know this is confusing if you have many associations , but its sorting my data how i wanted without any error in this moment