Okay....here's what I did.

Used AD7six's advise and did a quick unbind from a hasMany and bind a
hasOne and did a findAll. This gives me all of the ID's that have the
course that was searched for. I then put these ID's in an array and
set them as part of the conditions for the next findAll and bring in
the other conditions.


                                if( $this->data['Course']['subjarea']!='all'){
                                        $search_termarea = 
$this->data['Course']['subjarea'];

                                        
$this->Course->unbindModel(array('hasMany' =>
array('Coursestocontentarea')));
                                        $this->Course->bindModel(array('hasOne' 
=>
array('Coursestocontentarea' => array('className' =>
'Coursestocontentarea'))));

$onlySubj = $this->Course-
>findAll(array('Coursestocontentarea.content_id' =>
$search_termarea),'id',null,null,null,1);

$hidvarrary = array();

foreach ( $onlySubj as $indivsubj )
{
$hidvarrary[] = $indivsubj['Course']['id'];
}
$conditions['Course.id'] = $hidvarrary;

                                }

                $this->set('Conditions', $conditions);
                $this->set('Courses', $this->Course->findAll($conditions,
null, null, null, null, 2));

        }

Not the cleanist, but it works well. Thanks so much!



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

Reply via email to