Skip to content

Trigger eager loading when using the attributes serializer option #1546

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 3 commits into from
Dec 6, 2017

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Dec 5, 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

TODO:

  • Add a test

@dunglas dunglas force-pushed the eager-load-attributes branch from 132741a to 748782b Compare December 5, 2017 17:15
@dunglas dunglas force-pushed the eager-load-attributes branch from 748782b to fe80ac4 Compare December 6, 2017 12:18
unset($context[AbstractNormalizer::ATTRIBUTES]);
}

if (
Copy link
Contributor

Choose a reason for hiding this comment

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

cs is strange here

Copy link
Member Author

Choose a reason for hiding this comment

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

Why?


if (
((!$inAttributes && false === $propertyMetadata->isReadableLink()) || false === $propertyMetadata->isReadable()) &&
false === $propertyMetadata->getAttribute('fetchEager', false)
Copy link
Member

Choose a reason for hiding this comment

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

false === $propertyMetadata->getAttribute('fetchEager', false) should not be needed here as it should've been tested https://github.com/dunglas/core/blob/master/src/Bridge/Doctrine/Orm/Extension/EagerLoadingExtension.php#L142

Did you start you PR on master? I can't recognize the replaced code which may have lead to weird copy/paste?

Copy link
Member Author

Choose a reason for hiding this comment

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

Can I let you handle that? I've changed this part (only the CS) and I'm not really comfortable with it.

@dunglas dunglas merged commit d7d78ab into api-platform:master Dec 6, 2017
@dunglas dunglas deleted the eager-load-attributes branch December 6, 2017 14:03
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.

3 participants