Automatic generate compare

How to generate automatice compare?

I have one field some time is it array(2-3-4… variable).


example:

example=> "one"

or

example=> "one", "two"


The example query is:

example like %one% or %two%

or

example like %one%



My code is:


this->_criteria->compare($example, $value, true);

But is generate this query’s.




1. example 

example=:ycp2

:ycp2 => one


2.example

example IN (:ycp2, :ycp3)

:ycp2 => one

:ycp3 => two



Solved: :)


foreach($value as $val) {

  $this->_criteria->addSearchCondition($hirdetes, $val);

}