I'm having some difficulty understanding how 'fields' is supposed to work when doing a find('threaded'). The following is a method in my Comment model. Comment can be associated with either Post or Gallery, hence the 'model' & 'association_key' fields.
public function threaded($key = null, $model = null) { if (!$key || is_null($model)) return null; $filters = array( 'conditions' => array( 'Comment.model' => ucfirst($model), 'Comment.association_key' => $key ), 'fields' => array( 'Comment.created', 'Comment.parent_id', 'Comment.lft', 'Comment.rght', 'Comment.model', 'Comment.association_key', 'Comment.user_id', 'Comment.subject', 'Comment.body' ), 'order' => array('Comment.lft' => 'ASC'), 'contain' => array( 'User' => array( 'fields' => array('User.id', 'User.login') ) ) ); return $this->find('threaded', $filters); } When I use it like that, I do not get properly threaded results-- comments that should have children do not. When I change the fields array (the first one, for Comment) to '*' the results are properly threaded. However, the User arrays contain all fields for that model. In the first example, the User results correctly contain just the id & login fields. So, am I missing something? Bug?
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en