Re: find all with at least one associated model

2010-11-03 Thread Max D
Thanks, I'm now using the counter cache. I tried the INNER join version as well and I got good looking result arrays, but it seems using GROUP BY in pagination messes pagination up. $this-paginate = array( 'Blog' = array( 'joins' = array( array(

Re: find all with at least one associated model

2010-11-02 Thread ohcibi
The easiest way would be to Use countercache and then just add post_count 0 to conditions... if you cant zdf countercache for some reason you could also inner join the posts Table, which would leave all blogs that have no assocciated post... On 1 Nov., 18:29, Max D max.doerf...@googlemail.com

find all with at least one associated model

2010-11-01 Thread Max D
Hi, i use cake 1.3 and I have a Blog hasMany Post association and now I want to find all the Blogs, which have at least one Post. I use the Containable Behavior. I understand, that I could do a Blog-find('all', array('contain' = array('Post'))) and simply filter the results for the Blogs, where