Skip to content

[12.x] Prevent preventsLazyLoading exception when using automaticallyEagerLoadRelationships #55771

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

Conversation

devajmeireles
Copy link
Contributor

While automaticallyEagerLoadRelationships is still advertised as "Beta", it is available for use - I have personally used it in production and have seen good behavior from it, and for this reason it no longer makes sense to throw the preventsLazyLoad exception when automaticallyEagerLoadingRelationships is enabled.

@taylorotwell taylorotwell merged commit 40edd68 into laravel:12.x May 19, 2025
61 checks passed
@francoism90
Copy link

Wouldn't it still be possible to have a lazy load exception?

I did first define preventsLazyLoad after automaticallyEagerLoadingRelationships for this reason.

It tries to automatically eager relationships, now you completely disable any feedback if it doesn't?

@decadence
Copy link
Contributor

decadence commented May 21, 2025

I don't see much point in this change either. If automaticallyEagerLoadingRelationships is working correctly then the code will not reach this point. If it's wrong in some situations (packages or some complex cases) then we should see the exception but after this change we won't.

automaticallyEagerLoadingRelationships works with preventLazyLoading nicely.

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.

4 participants