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

FIX Empty relations don't have extra DB calls with eager-loading #10886

Conversation

GuySartorelli
Copy link
Member

@GuySartorelli GuySartorelli commented Jul 24, 2023

@@ -1101,7 +1107,7 @@ private function fetchEagerLoadRelations(Query $query): void
$relationDataClass,
implode('.', $chainToDate),
$relationName,
$parentRelationName
Copy link
Member Author

@GuySartorelli GuySartorelli Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The $parentRelationName argument was never used - in fact there wasn't even a parameter for it

Comment on lines +1436 to +1439
case 'has_one':
$dummyData = Injector::inst()->create($relationDataClass);
break;
Copy link
Member Author

@GuySartorelli GuySartorelli Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has_one isn't used currently (see the comment about why it's not necessary in fetchEagerLoadHasOne()), but it's here for the sake of completion. It is technically valid to pass in here, and shouldn't throw an exception if we do for some reason pass it in.

@GuySartorelli GuySartorelli force-pushed the pulls/5/eagerloaded-empty-lists branch 2 times, most recently from 2c1f09c to fe1cf44 Compare August 3, 2023 04:13
Copy link
Member

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just need to update variable names so things are consistent and easier to understand

src/ORM/DataList.php Outdated Show resolved Hide resolved
src/ORM/DataList.php Outdated Show resolved Hide resolved
src/ORM/DataList.php Outdated Show resolved Hide resolved
src/ORM/DataList.php Outdated Show resolved Hide resolved
src/ORM/DataList.php Outdated Show resolved Hide resolved
src/ORM/DataList.php Outdated Show resolved Hide resolved
src/ORM/DataList.php Outdated Show resolved Hide resolved
src/ORM/DataList.php Outdated Show resolved Hide resolved
src/ORM/DataList.php Outdated Show resolved Hide resolved
src/ORM/DataList.php Outdated Show resolved Hide resolved
@GuySartorelli GuySartorelli force-pushed the pulls/5/eagerloaded-empty-lists branch from fe1cf44 to c19ef77 Compare August 3, 2023 22:09
@GuySartorelli GuySartorelli force-pushed the pulls/5/eagerloaded-empty-lists branch from c19ef77 to aff4ee7 Compare August 3, 2023 22:10
@emteknetnz emteknetnz merged commit 3628cec into silverstripe:5 Aug 4, 2023
12 checks passed
@emteknetnz emteknetnz deleted the pulls/5/eagerloaded-empty-lists branch August 4, 2023 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants