CakePHPの検索操作でのorderByに関する簡単な質問が1つだけあります。3つのモデルが相互に関連付けられているとしましょう。3つのモデルのいずれかでfind('all')
cakePHPクエリを実行すると、他の2つのモデルのデータも含む結果が得られます。たとえば、私のモデルが次のようになっているとします。
1- User
2- School
3- Country
$this->find('all')
内部で行うUsersController
と、3つのモデルがリンクされているため、次のようになります。
Array
(
[0] => Array
(
[User] => Array
(
[id] => 'the_auto_incrementing_id'
// other table columns
[created] 'creation_date'
[modified] 'modification_date'
)
[School] => Array
(
[id] => 'the_auto_incrementing_id'
// other table columns
[created] 'creation_date'
[modified] 'modification_date'
)
[Country] => Array
(
[id] => 'the_auto_incrementing_id'
// other table columns
[created] 'creation_date'
[modified] 'modification_date'
)
)
)
私の質問はこれですが、私のfind('all')
クエリはモデルで開始されましたが、たとえばモデルのフィールドを言うUser
ことは可能ですか?orderBy
created
School
それが可能かどうか教えてください
ありがとうございました