Search And/or

hi all,

this is what I have in my controller:


$hoses = HoseConfiguration::model()->findAll( $model->getHoseCriteria() );

where $model->getHoseCriteria() looks like:




CDbCriteria Object

(

    [select] => *

    [distinct] => 

    [condition] => 

    [params] => Array

        (

        )


    [limit] => -1

    [offset] => -1

    [order] => 

    [group] => 

    [join] => 

    [having] => 

    [with] => Array

        (

            [hose.hose_supplier] => Array

                (

                    [condition] => hose_supplier.name LIKE :sup

                    [params] => Array

                        (

                            [:sup] => eaton%

                        )


                )


            [hose] => Array

                (

                    [condition] => (hose.size = :size)

                    [params] => Array

                        (

                            [:size] => 10

                        )


                )


        )


    [alias] => 

    [together] => 

    [index] => 

    [scopes] => 

    [_e:CComponent:private] => 

    [_m:CComponent:private] => 

)



now, the result seems to be an OR of the 2 conditions, where I’d rather prefere an AND.

How can I achieve that?

thanks a lot

nobody on this topic? please I really need help with this…

While creating a CDbCriteria you can define a condition with




$cdbcriteria->addCondition();



So, in this you can define mixed String condition. also you can put a operator as a second param.

But still it would be great if you can share you code for $model->getHoseCriteria() method.So, answer can be more accurate. :)