How about using an inner join?
If I understand correctly, there is a way to change the type of join that is
being performed on two models (defaults to left).

Try the 7th message in
http://groups.google.com/group/cake-php/browse_thread/thread/9f092441185a5b72/f32a7b86bc9ec5d1?lnk=gst&q="inner+join"&pli=1<http://groups.google.com/group/cake-php/browse_thread/thread/9f092441185a5b72/f32a7b86bc9ec5d1?lnk=gst&q=>

<http://groups.google.com/group/cake-php/browse_thread/thread/9f092441185a5b72/f32a7b86bc9ec5d1?lnk=gst&q=>Uses
an example for the middle model in a HABTM:
*var $belongsTo = array(
                        'Group' => array('type' => 'INNER'),
                        'Forum' => array('type' => 'INNER')
        ); *

Maybe you could put that in your photo model and give it a try

2009/6/22 Kyle Decot <[email protected]>

>
> I am building a search form and I want the user to be able to select a
> checkbox to only show results that has photos. My model uses a hasMany
> = ("Photo"); How do I write my conditions array? I've tried the
> following but get an "Invalid use of group function".
>
> $conditions [] = "COUNT(Photo) > 0";
>
> $this->paginate("MyModel",$conditions);
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to