Hi, thx for the answers!
I just found the problem, the array is ok as is the find, the problem is caused by one of my behaviors where I the condition is influenced. Funny that just yesterday something similar happened to one guy on irc channel I tried to help with non working pagination. Never trust a behavior, least the own ones. ;-) Michael On 28 Aug., 11:47, Vishal G <[email protected]> wrote: > Hi, > > yes, you are on right track... this is how you should do it > > $audios = $this->Audioplaylist->Audio->find('all', > array('conditions' => array('Audio.id' => $audioIds) ) > ); > > This will translate to Audio.id IN (1, 2, 3) > > Your problem might be because of your array. > > Make sure your array $audioIds is one dimensional array > > V > > On Aug 28, 1:50 pm, schneimi <[email protected]> wrote: > > > Hi, > > > I have an array with some ids of a model and struggle with getting > > them into a find condition. > > > This is what I currently use, it works but is not very caky: > > > $audioIds = array('1', '2', '3',....); > > $audios = $this->Audioplaylist->Audio->find('all', array('conditions' > > => 'Audio.id='.implode(' OR Audio.id=', $audioIds))); > > > I think it should look like this the cake way: > > > $audios = $this->Audioplaylist->Audio->find('all', array('conditions' > > => array('Audio.id' => $audioIds))); > > > but this results in [...] AND `Audio`.`id`=Array [...] > > > I already had a look into the cookbook and played around alot, but > > couldn't figure out a proper way, so I hope you can help me. > > > Thx, > > Michael --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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 -~----------~----~----~----~------~----~------~--~---
