How to implement \Phalcon\Mvc\Model::findIn()?

后端 未结 1 1012
广开言路
广开言路 2021-01-28 09:17

Fairly simple question, but I can\'t seem to find anything about it.

I\'ve got a set of ids, and I need to find all matching records.

So I\'d like to query :

相关标签:
1条回答
  • 2021-01-28 09:45

    Check out the Phalcon\Mvc\Model\Criteria, in the inWhere method.

    You could create a new model's method like:

    public static function findIn(array $identifiers)
    {
        return self::query()
            ->inWhere('id', $identifiers)
            ->execute();
    }
    
    0 讨论(0)
提交回复
热议问题