You probably just need to set the model to be containable.
i.e.
$this->ModelName->Behaviors->attach('Containable');
var $paginate = array(
       'limit' => 10,
       'page' => 1,
       'order'=>array('Site.sort_order' => 'ASC'),
       'fields' => array('*'),
       'contain' => array(
               'SiteIllustration' => array(
                       'fields' => array('id'),
                       'SiteIllustrationThumb'
               )
       )
);
$result = $this->paginate('ModelName');

Let me know if this helps.

On 22 July 2010 19:50, cricket <[email protected]> wrote:

> using 1.3.3
>
> Site hasOne SiteIllustration
> SiteIllustration belongsTo Site
> SiteIllustration hasOne SiteIllustrationThumb
> SiteIllustrationThumb belongsTo SiteIllustration
>
> In my SitesController, I'm calling paginate() to fetch my data. I want
> the Site data, plus the SiteIllustrationThumb data. Without a
> $paginate class var, I get the Site and SiteIllustration data, which
> is expected. But, after adding:
>
> var $paginate = array(
>        'limit' => 10,
>        'page' => 1,
>        'order'=>array('Site.sort_order' => 'ASC'),
>        'fields' => array('*'),
>        'contain' => array(
>                'SiteIllustration' => array(
>                        'fields' => array('id'),
>                        'SiteIllustrationThumb'
>                )
>        )
> );
>
> ... the output remains the same. I do have $actsAs =
> array('Containable') in AppModel. In fact, I can see the DB queries to
> fetch the SiteIllustrationThumb data (and they work as expected from a
> terminal).
>
> I know that I've run into trouble before with Containable and deep
> associations but, AFAIK, that was resolved by ensuring that the id
> field was specified for the "in between" models (SiteIllustration in
> this case).
>
> Anyone got an idea what the issue is here? I have debug set to 2 and
> caching is disabled.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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]<cake-php%[email protected]>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to