Hi,

I've been using CakePHP for about a month and a half now, and I love
it. I'm just wondering about how CakePHP only even does one-level 'LEFT
JOIN's. What I mean is if we have three Models: Item, Section and Area,
and have these relationships:

Item belongsTo Section,
Section belongsTo Area,

By setting Item.recursive we can get all related models in one find()
call, however CakePHP generates two queries:

Item LEFT JOIN Section ON ... WHERE Item.id = ?

and

Section LEFT JOIN Area ON ... WHERE Section.id = <some value from the
previous query>

Is there any particular technical reason why CakePHP can't generate
something like:

Item LEFT JOIN Section ON ... LEFT JOIN Area ON ... WHERE Item.id = ?

I have the beginnings of an algorithm in my mind that may be able to do
this, it involves a graph where models are the nodes and relations are
edges. Basically you can generate the SQL by doing a depth first dearch
only following belongsTo and hasOne edges.

I'm just wondering if a) this has already been done, or b) there is
some reason why it is a bad idea.

 - Ivan


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