You can use
 $this->Profile->unbindModel(array('hasOne' =>array('main_image')))
 before
$this->Profile->findAll()



On 2月14日, 下午5时21分, "mallyone" <[EMAIL PROTECTED]> wrote:
> I'm trying to figure out how to return a list of users with only one
> user_image, the one with 'main'=1 in the user_images table.
>
> I also need to be able to return user.*, and it's associated images
> for another action.
>
> How should I handle this?  Should I make another model called
> profile_single_image or something that would
> handle this kind of query?  Can I ask it to ignore the user_image part
> of the model when using findAll?  What's the best practices way?
>
> Thanks in advance...
>
> P.S. here's my model
> <?php
> class Profile extends AppModel
> {
>         var $name = 'Profile';
>         var $useTable = 'Users';
>         var $hasOne = array('main_image' =>
>            array('className'     => 'UserImage',
>                  'conditions'    => 'main=1',
>                  'order'         => '',
>                  'limit'         => '1',
>                  'exclusive'     => false,
>                  'finderQuery'   => ''
>            )
>     );
>         var $hasMany = array('user_image' =>
>                              array('className'     => 'UserImage',
>                                    'conditions'    => '',
>                                    'order'         => '',
>                                    'limit'         => '',
>                                    'exclusive'     => false,
>                                    'finderQuery'   => ''
>                              )
>                       );
>
> }
>
> ?>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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