On 9/26/07, villosil <[EMAIL PROTECTED]> wrote:
>
> Hi!,
>
> I have a doubt that I can't solve. I have an array of ids of some
> Model
>
> array('1','5','12','13,'15','23,..);
>
> There's any way to do a Model->findAll() to retrive data of every of
> these ids?
>

Hrm...I just did some digging around on Google and experimented with
some code, and I believe this should work just fine in Cake 1.2.x.x

$this->Model->findAll(array('Model.field' => array(1, 5, 12, 13, 15, 23)));

I did the following query:

$this->Media->findAll(array('Media.published' => array(0,1)), 'Media.id');

which should be saying "give me the Media.id of all records where
Media.published is 0 or 1).  It generated the following SQL:

SELECT `Media`.`id` FROM `media` AS `Media` WHERE `Media`.`published` IN (0, 1)

Hope that helps.

-- 
Chris Hartjes
Senior Developer
Cake Development Corporation
http://www.cakedevelopment.com

My motto for 2007:  "Just build it, damnit!"

@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to