ikkez / f3-cortex

A multi-engine ORM / ODM for the PHP Fat-Free Framework
GNU General Public License v3.0
118 stars 22 forks source link

Search for array values #75

Open ursulnegrul opened 5 years ago

ursulnegrul commented 5 years ago

Given a Jig mapper:

{
"set": 123,
"opt": [
            4,
            5,
            6
        ],
}

How can I search using IN array

 $Obj->load([
'set = :set AND :opt IN opt',
 ':set' => 123,
 ':opt' => 5
]);

I guess is not possible and I should use relationships?

ikkez commented 5 years ago

Well it would be possible with the raw Jig Mapper, but there's no handy feature in the cortex query parser that would help here. however, you can write it as php filter instead, try: $obj->load(['set = :set and in_array(:opt,@opt)', ':set'=> 123, ':opt'=> 5]).

Not tested though.

ursulnegrul commented 5 years ago

Nope, it searches for the "in_array" column.