• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Implemented Add IN and NOT IN operators for the finder

Sadik B

Well-known member
I see this,

switch ($operator)
            case '=':
            case '<>':
            case '!=':
            case '>':
            case '>=':
            case '<':
            case '<=':
            case 'LIKE':
            case 'NOT LIKE':
            case 'BETWEEN':

                throw new \InvalidArgumentException("Operator $operator is not valid");

Not sure why the IN operator is excluded. It is useful in many cases when extending a repository. Else we have to use many whereOr conditions which doesn't seem ideal.


Well-known member
The = and != operators are automatically converted to "IN" and "NOT IN" when dealing with arrays.

LIKE and NOT LIKE are also compatible with using arrays

Chris D

XenForo developer
Staff member
Indeed. There's a slightly different code path for array values. You'll notice on line 285 of XF\Mvc\Entity\Finder that if a non array value is used then it will return return "$lhs $operator $quoted";.

Below that it starts dealing with IN, NOT IN, LIKE and NOT LIKE etc.