Following code throws exception "Invalid SQL expression type 'list'":
$condition = 'id IN(1,2,4)';
Model::find($condition);
I can't believe that phalcon does not support this. What is the correct way to setup this rule?
Following code throws exception "Invalid SQL expression type 'list'":
$condition = 'id IN(1,2,4)';
Model::find($condition);
I can't believe that phalcon does not support this. What is the correct way to setup this rule?
To setup this rule, we should simply setup ids list as key => value:
$ids = [1,2,3];
Model::find(['id' => $ids]);
Hope this would be helpful for somebody.
UPD: this will NOT work, numbers should be not array, but string:
Model::find('id IN (1,2,3,4)');
There was a bug with such construction, but it was fixed in 0.8.0 version.