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
-~----------~----~----~----~------~----~------~--~---

Reply via email to