Hi Jeremy,
I think you can do that in your model with afterFind callback. For
example:
class MyModel extends AppModel{
var $actsAs = array('Tree');
function afterFind($results, $primary){
// for multiple result
if(is_array($results)){
if(is_array($results[0])){
foreach($results as $key => $val){
$results[$key][$this->alias]['childCount'] = $this->childCount
($results[$key][$this->alias][$this->primaryKey]);
}
} else { // for single result
$results[$this->alias]['childCount'] =
$this->childCount($results
[$key][$this->alias][$this->primaryKey]);
}
}
}
}
Note: I am not test this code myself.
Hope this help.
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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en