I have a question about findCount. Let's say I have a list of Users and each User hasMany Posts What I want to be able to do is show a list of Users and a count of how many "expired" and "live" posts they have like this
Bob | 2 Live Posts | 3 Expired Posts Jane | 0 Live Posts | 4 Expired Posts Trent | 12 Live Posts | 1 Expired Posts I have this in my model $hasMany = array( 'LivePosts' => array( 'className' => 'Posts', 'conditions' => 'live = 1' ), 'ExpiredPosts' => array( 'className'=>'Posts', 'conditions'=>'live = 0' ) ); In my Users controller I do a findAll with recursive of 1 Then in my view I count up all the 'LivePosts' and 'ExpiredPosts' items. This seems horribly inefficient to do since all I'm looking for is a count of these items and not the items themselves. Is there a way for findCount to say just count all my LivePosts and ExpiredPosts and store it as another variable in the controller data array? Has anyone done anything like this? Thanks for your help --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
