Reputation: 13190
Is there a way to do a find() in CakePHP that converts to an IN condition? It seems the find() methods just take a single value to search on.
I would like to do something like this:
$this->User->findAllById(array(1, 5, 7));
which would convert the SQL to something like:
SELECT * FROM users WHERE id IN (1, 5, 7);
Upvotes: 5
Views: 13163
Reputation: 522005
$this->User->find('all', array('conditions' => array('id' => array(1, 5, 7))));
Upvotes: 13