That worked! The only problem is that it creates a ton of queries...
instead of just LEFT JOIN ing the Shift table into the select query,
CakePHP is issuing a separate query for each related Shift record. In
addition to being inefficient, this means that I can't use Shift
fields in my condition, fields, or order values :(

I guess I should just write a custom query and skip bypass Cake's
database abstraction.

Thanks for all your help!

- Scott


On Oct 13, 6:11 am, francky06l <[EMAIL PROTECTED]> wrote:
> I faced the same problem. It seems there is a (recent bug) bug in
> containable (I use the SVN branch). It does not adjust the recursive
> properly.
> Try you query adding 'recursive' =>  3 and that should do it..
>
> hth
>
> On Oct 13, 7:58 am, francky06l <[EMAIL PROTECTED]> wrote:
>
> > Did you check the generated query ? Does it contain the shifts table?
>
> > On Oct 13, 4:43 am, squidliberty <[EMAIL PROTECTED]> wrote:
>
> > > As an experiment, I downloaded a fresh copy of Cake 1.2 and added only
> > > the scripts above. I wanted to confirm that this was not a problem
> > > caused by my existing site's configuration. The new installation
> > > produced identical results, so there must be something wrong with the
> > > approach. Maybe I'm just overlooking something obvious...
> > > - Scott
>
> > > On Oct 12, 5:44 pm, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > > After reading again the post
>
> > > > $this->find('all', array(
> > > >         'contain' => array(
> > > >                 'Department', 'Sale' => 'Shift(closed)'),
> > > >         'fields' => array('Log.cost')
> > > >         ),
> > > > );
>
> > > > Hope this works, I did not catch all relations at first glance, you
> > > > might also use the containable behaviors in the Sale / Departement
> > > > model ..
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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