views:

20

answers:

1

Good Morning People!

i have an array of products id's:

$product_ids = array(10,14,15,...);

and i want to find all the corresponding products on the DB using Cakephp's ORM. I'm using Mysql so the query would be something like:

SELECT *
FROM products
WHERE id
IN ( 10, 14, 15,... )

I could use the query() function, but it's seems like a sloppy way to solve this problem. Maybe i could use the find() function, but i don't know how... any ideas??

Thanks in advance!

+2  A: 

Have you tried:

$this->Product->find('all', array('conditions' => array('Product.id' => $product_ids)));

?

PawelMysior
wow... it works =D i just assumed that it wouldn't work. i guess that i underestimated the power of cake. Thxs!
pleasedontbelong