Skip to content

EagerLoadingExtension: respect fetchEager=false on an association #1897

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

Merged
merged 1 commit into from
Apr 27, 2018
Merged

EagerLoadingExtension: respect fetchEager=false on an association #1897

merged 1 commit into from
Apr 27, 2018

Conversation

bendavies
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

forceEager/fetchEager does not already result in a performance boost, so being able to disable it per association is crucial.

This:

@ApiProperty(attributes={"fetchEager": false})

Was not being respected, and ignored if the association was readable or a readableLink.

@dunglas I don't really understand the if statement that this PR fixes, specifically the variable $inAttributes.
You introduced it here: #1552. I'd be grateful if you could check this over and explain the if?

Thanks

@@ -170,14 +170,13 @@ private function joinRelations(QueryBuilder $queryBuilder, QueryNameGeneratorInt
$inAttributes = null;
}

$fetchEager = $propertyMetadata->getAttribute('fetchEager');
if (false === $fetchEager) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be inlined

Copy link
Member

@soyuka soyuka left a comment

Choose a reason for hiding this comment

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

👍 I was going to look into this tomorrow 😄.

@dunglas dunglas merged commit 1b650ee into api-platform:2.2 Apr 27, 2018
@dunglas
Copy link
Member

dunglas commented Apr 27, 2018

Thank you @bendavies

teohhanhui pushed a commit to teohhanhui/api-platform-core that referenced this pull request May 2, 2018
…force-eager

EagerLoadingExtension: respect fetchEager=false on an association
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.

5 participants