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

Eager loading extender #2724

Merged
merged 5 commits into from
Mar 25, 2021
Merged

Eager loading extender #2724

merged 5 commits into from
Mar 25, 2021

Conversation

SychO9
Copy link
Member

@SychO9 SychO9 commented Mar 21, 2021

Part of #2637

Changes proposed in this pull request:
Adds a load() method on the ApiController extender that allows extensions to specify relations that need to be loaded in listing controllers. This works when controllers use the appropriate loadRelations($collections, $relations) method.

A first level relationship will always be loaded, whereas a sublevel relationship will only be loaded if the parent level is/will be loaded.

As for the noticiations endpoint that has the subject polymorphic relationship, I would like to add in another pull request a loadMorph method to this same extender that would solve the problem.

Reviewers should focus on:

Confirmed

Copy link
Member

@askvortsov1 askvortsov1 left a comment

Choose a reason for hiding this comment

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

This will need a bit in the extension development docs, so that we can point extension devs to an explanation of how to use it.

src/Extend/ApiController.php Outdated Show resolved Hide resolved
src/Extend/ApiController.php Outdated Show resolved Hide resolved
@SychO9 SychO9 requested a review from askvortsov1 March 23, 2021 19:03
@SychO9 SychO9 merged commit 1c4817a into master Mar 25, 2021
@SychO9 SychO9 deleted the sm/2637-nplusone-queries-extender branch March 25, 2021 14:36
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