Skip to content

Improved joins when using the properties filter #1552

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 2 commits into from
Dec 8, 2017

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Dec 7, 2017

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

Follows #1546. This PR allows API Platform to add useful SQL JOIN clauses and to remove the useless ones according to properties selected by the client using the property filter.
That's a massive performance improvement when using this filter.

I'll also use this feature later to improve the generated SQL queries when using GraphQL. It will allow to only fetch what is required for a given GraphQL query while to reducing dramatically the number of issued SQL queries for a whole GraphQL request.

@dunglas dunglas requested review from soyuka and meyerbaptiste and removed request for soyuka December 7, 2017 08:45
false === $propertyMetadata->getAttribute('fetchEager', false) &&
(
false === $propertyMetadata->isReadable() ||
((!$useAttributes && $isNotReadableLink) || ($useAttributes && !$inAttributes))
Copy link
Member

Choose a reason for hiding this comment

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

linter has an issue with inAttributes anyway it's fine to me. Glad to see the EagerLoading extension serve it's purpose :D.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed!

@dunglas dunglas merged commit 159154f into api-platform:master Dec 8, 2017
@dunglas dunglas deleted the improved-attributes branch December 8, 2017 07:26
hoangnd25 pushed a commit to hoangnd25/core that referenced this pull request Feb 23, 2018
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