Try this

   $his->User->recursive  = 2;
   $this->set('data', $this->User->read(null, $id));


In the view:

pr($data); // <--- data is a bad name :P

2007/11/29, bibi <[EMAIL PROTECTED]>:
>
> I have a model witch use a hasAndBelongsToMany collection
>
> class User extends AppModel
> {
>   var $hasAndBelongsToMany = array(
>     'Photo' => array('className' => 'Photo',
>       'joinTable' => 'photo_users',
>       'associationForeignKey' => 'User_id',
>       'foreignKey' => 'Photo_id',
>       'unique' => true,
>       'finderQuery' => '',
>       'deleteQuery' => '',
>       'insertQuery' => '')
>   );
> ....
>
> I want to get the Photo's User in the user controller...
>
> class UsersController extends AppController
> {
>   var $uses = array('User','Photo','PhotoUser');
>   function view($id)
>   {
>     $this->User->setId($id);
>     $this->set('data', $this->User->read());
>     $this->set('photos', findMyPhotos($id) );
>   }
> ....
>
> How can i get my photos from the user controller ?
> Best regards
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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