CakePHP order query results on more than 1 level

streetcleaner

New Member
I'm using the Containable behavior to get a list of Comments (belongsTo Post, which belongs to Question; Question hasMany Post, and Post hasMany Comments; all of these belong to Users).\[code\]$data = http://stackoverflow.com/questions/2086509/$this->Question->find ('first', array ('contain' => array ('User', 'Post' => array ('User', /* 'order' => 'User.created DESC'*/ ) ) ) );\[/code\]It works, when I comment out the section in comments above. I suppose this is to be expected, but what I want is all of the Posts that are found, should be sorted in order of the 'created' field of the 'User' they belong to. How do I accomplish this deeper level sorting in CakePHP? I always get, "Warning (512): SQL Error: 1054: Unknown column 'User.created' in 'order clause'"Thanks for your help!
 
Back
Top