Alrights, here are my errors: 1) I tried associating two models instead of 1. 2) Your remark on building web applications fast really helped me. I waste about 5-10% of my time now optimizing these things, and now I realize I shouldn't [maybe far later].
Again optimization..: LoadModel takes more time than a bind, doesn't it? http://bin.cakephp.org/view/1965044820 Here's the code I use. This is the most complex query I have in my software. It's a component, calling a model through a controller. The end result: field Section.section_id gets the fields TemplateLayout.style and Template.directory On Aug 13, 3:28 pm, Grant Cox <[EMAIL PROTECTED]> wrote: > This is not a bug. Unless the query generated includes a join to the > TemplateLayout model's table, then you cannot include those fields. > What associations are there between the three models? Since Cake's > JOINS will only join a single association, it may be possible for you > to query the Layout model (with the Layout's section_id, if it has > one), and so in one query bring in the TemplateLayout.style. > > But realistically, don't worry if your query also gets a few extra > fields. I am sure that it will not be the performance bottleneck in > your application - and Cake is about building applications quickly (ie > code everything the simple / straightforward way - don't try to > "optimize" things that don't need to). > > Since you say it works in recursive 2 these points probably just > relate to your poor posting style. > > 1. What is with $this->controller->$model->Section ? You should be > using just $this->Section in your controller > 2. If you want to bind Section to Layout, either do it in the > Section's inline associations, or if you must use bindModel, do it > properly: > $this->Section->bindModel( array( > 'hasMany'=>array( > 'Layout'=>array( 'className' => 'Layout' ) > ) > ) ); --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---