Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honor primary_key option in $belongs_to and $has_many when eager loading #578

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Commits on Jul 27, 2017

  1. Configuration menu
    Copy the full SHA
    d06179a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    aa7f78a View commit details
    Browse the repository at this point in the history

Commits on Jan 9, 2020

  1. Fix eager loading of nested relationships

    Before this change, some eager loaded nested relationships were wiped out
    when some first-level relationships were the same model object.
    
    For example, when 2 `Post`s have the same `Author` and you load posts
    with option `'include' => ['author' => ['profile']]`, then first loaded
    post will have eager loaded author with eager loaded profile, while
    the second post will have eager loaded author (cloned), but without
    eager loaded profile. `clone` method just doesn't clone the relationships
    of cloned author.
    
    This leads to a serious performance degradation. Because you expect all
    relationships are eagerly loaded when traverse them in the code, while
    in reality only some of them are loaded, and others generate many
    unnecessary SQL queries to load them on-the-fly.
    
    After this change, nested relationships will be cloned recursively
    instead of wiping them out completely. This leads to expected behavior,
    when all eagerly loaded relationships will be preserved and fixes the
    performance degradation.
    xak2000 committed Jan 9, 2020
    Configuration menu
    Copy the full SHA
    a7432fb View commit details
    Browse the repository at this point in the history