Thursday, July 30, 2009

Re: Efficient ways to retrieve data from models with high association depth

have you tried using Containable behavior?

On Jul 30, 12:16 pm, Roel <roel....@gmail.com> wrote:
> Hi,
>
> I'm using CakePHP for quite some time now and I really love it, but I
> hadn't come around to make use of the complex association
> possibilities for models. So I started to play around with them for a
> personal project I just started. Although the advantages Cake offers
> are numerous, I stumbled across an issue I'm not happy about. It's not
> a bug but an effciency issue.
>
> Let's say we have three models: Article, Comment, and User. The
> relationships are as follows: Article hasMany Comment, Comment hasOne
> User. Now when the data for Article is retrieved, a nice JOIN query is
> used to fetch the Comment data together with the Article data, but a
> seperate query is made for each User instead of using a nice JOIN
> statement.
>
> Now I know this is a known issue (https://trac.cakephp.org/ticket/
> 2931) and I understand why the resolution is set to 'wont fix', but I
> wondered how other people worked around this or maybe didn't even
> bother. Truth is, in this specific case of my personal project it
> doesn't even matter that much. It doesn't need to serve thousands
> users. But it bothers me that Cake, which first enabled me to
> elegantly develop applications fast, now kinda shows it's dirty side.
>
> So what are your thoughts about retrieving data efficiently with Cake?
--~--~---------~--~----~------------~-------~--~----~
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 cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: