You bind your model again, using 'fields' option to set the fields you
want :
$this->Post->bindModel(array('hasMany' => array('Comment' =>
array('className' => 'Comment',
'fields' => array('field you
want'))));
On Nov 10, 4:55 am, Action <[EMAIL PROTECTED]> wrote:
> I want to be able to retrieve multiple blog posts as well as the
> comment count for each post. I do not want to retrieve the comments
> themselves, just the comment count.
>
> This is what I have so far:
>
> $this->Post->unbindModel(array('hasMany' => array('Comment')));
>
> $this->set('data', $this->Post->find('all', array('order' => 'created
> DESC')));
>
> I unbound the model association so it wouldn't pull the comments in
> the query. How can I make it so the find() as also grabs the comment
> count for each post it is grabbing?
>
> If I kept the association it would work, but I would have to also pull
> all of the comment data as well, which is something I don't want to
> do.
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---