Model relationships should be lazy loaded #80

Closed
mincms1 opened this Issue Aug 18, 2011 · 2 comments

Comments

Projects
None yet
3 participants
@mincms1

mincms1 commented Aug 18, 2011

it is not support layz load relationship
if Posts.php blongsto Users.php Users.php hasone Profiles
now i findAll Posts ,must be use with=>'Users' that will show Users fileds, also i can not find Profiles.that is not good.
could you consider not use with . like $post->user->username and $post->user->profile->nickname ,let they are working.
that is good idea.
do you thinking.
thank you

@Howard3

This comment has been minimized.

Show comment Hide comment
@Howard3

Howard3 May 19, 2012

Member

It's possible. The one concern I have regarding this is the potential number of queries you could run against. If you are iterating through 50 users and fetching all of their nicknames you'll be doing more than 50 queries to achieve this. In the grand scheme of things it may be more efficient to just prefetch the information.

Member

Howard3 commented May 19, 2012

It's possible. The one concern I have regarding this is the potential number of queries you could run against. If you are iterating through 50 users and fetching all of their nicknames you'll be doing more than 50 queries to achieve this. In the grand scheme of things it may be more efficient to just prefetch the information.

@hans-d

This comment has been minimized.

Show comment Hide comment
@hans-d

hans-d Jul 16, 2012

Contributor

For performance it might be better indeed to use a form of (the currently not yet existing) chained relationships instead of a lazy loaded variant, eg 'with' => array('user', 'user.profile')) .

Contributor

hans-d commented Jul 16, 2012

For performance it might be better indeed to use a form of (the currently not yet existing) chained relationships instead of a lazy loaded variant, eg 'with' => array('user', 'user.profile')) .

@mincms1 mincms1 closed this Jul 18, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment