Skip to content

Disable eager loading for some includes #500

Answered by dominikb
cnelson-ma asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @cnelson-ma,

thanks for opening up a discussion.

The eager loading occurs weather you specify allowedIncludes or not.

This should not happen. There are two different cases:

  1. No allowedIncludes() call is made at all -> every include parameter gets ignored silently
  2. allowedIncludes() does not contain a user-supplied parameter -> an InvalidIncludeQuery gets thrown.

Can you try to isolate the issue in a failing test case? I'd be happy to fix this issue, once isolated.

It looks like there is even a TODO for this: https://github.com/spatie/laravel-query-builder/blob/master/src/Concerns/AddsIncludesToQuery.php#L81

This TODO likely exists to allow us to give the user a more meaningful exce…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@cnelson-ma
Comment options

Answer selected by cnelson-ma
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants