Help With Activerecord Or Operator

Hi, I am having an issue which I know is simple but can’t figure it out.

I have an array of attributes that come from the user, for example colors:

array(blue, red, green, pink)

I have a model class that extends from activerecord that has color as an attribute.

Using activerecord I want to search for all records that have blue OR red OR green OR pink.

How can achieve this?

Thanks in advance!!!

You can use addInCondition() or addCondition (take a look at second argument)


addCondition(mixed $condition, string $operator='AND')

Hi Orey, thanks for your reply!

I finally did it with compare(‘color’, array(blue, green, red), ‘or’);

Thanks again!

German