You mean something like this ?

     $id = $myArray;
    $this->paginate = array('Post' => array('conditions' => array('User.id' 
=> $id)));
    $data = $this->paginate('Post');
        $this->set('posts', $data);

?

Many thanks.

Le lundi 18 juin 2012 17:26:21 UTC+2, JonStark a écrit :
>
> Here is the function I use to display posts that have a User.id equal to 
> $id :
>
> Code: php
>
>    1. $data = $this->paginate('Post', array <http://www.php.net/array>(
>    2.               'User.id' => $id,
>    3.         )
>    4.       );
>    5.         $this->set('posts', $data)
>    
> I have an array produced when researching user IDs matching certain 
> criterias :
> Code: php
>
>    1. array <http://www.php.net/array>(
>    2.   (int) 0 => '2',
>    3.   (int) 1 => '4',
>    4.   (int) 2 => '7' //etc
>    5. )
>    
>
> Is there a way for cake to associate this array to $id,so that 
> $this->paginate would display only posts whose ID is (in this exemple) 2, 4 
> or 7 ?
>
> Thanks a lot !
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to