Thanks for your answer, but that's not my problem, I need $this->Asset- >recursive = 2; else, I won't get all the data I need about the Asset.
I don't understand why when my model gets the Composer, it does : > > SELECT ... FROM tbl_composer WHERE component_id=12 -> gives me every > > composite_id (let's say 15,17 and 21) > > SELECT ... FROM tbl_asset WHERE id=15 > > SELECT ... FROM tbl_asset WHERE id=17 > > SELECT ... FROM tbl_asset WHERE id=21 And not something that looks more like : SELECT ... FROM tbl_composer LEFT JOIN ... as Component ON... LEFT JOIN ... as Composite ON ... WHERE component_id=12; because the Composite and the Component belongsTo the Composer. On 26 juil, 18:27, "Christopher E. Franklin, Sr." <[EMAIL PROTECTED]> wrote: > $this->Model->recursive = 0; <---try to put that beofre the > findAll()... it will limit how many queries are made and how much data > is returned. > > Does this answer your question? > > On Jul 26, 8:12 am, Saymons <[EMAIL PROTECTED]> wrote: > > > Hi everyone, > > > I am using CakePHP 1.1.last_version_here and PostgreSQL 8.0.12 > > I have a question about the belongsTo association : > > > My models are the following : > > Asset->HABTM Composer > > Composer -> BelongsTo Composite(Asset) and Component(Asset) > > > So an Asset can have many "sons" and many "parents" of the same type. > > > When I'm loading an Asset, the models reads well the data about the > > Asset himself, but when looking to the HABTM, it reads the Composer > > table, and then for each row of the table, it reads the Composite and > > the Component : > > SELECT ... FROM tbl_asset WHERE id=12 -> gives me data about the asset > > SELECT ... FROM tbl_composer WHERE component_id=12 -> gives me every > > composite_id (let's say 15,17 and 21) > > but then > > SELECT ... FROM tbl_asset WHERE id=15 > > SELECT ... FROM tbl_asset WHERE id=17 > > SELECT ... FROM tbl_asset WHERE id=21 > > > Is there a way that the Composer could join on the Asset table, not to > > have so many queries ? > > > Thx > > > PS : excuse my English, i'm french --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
