Skip to content

[12.x] Resolve issue with creating event and automatic eager loading #56208

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

Closed
wants to merge 6 commits into from

Conversation

jackbayliss
Copy link
Contributor

@jackbayliss jackbayliss commented Jul 3, 2025

When eager loading automatically, when the creating event & others occur via observers, or models. I noticed during tests that relationships would be set as null when using saveMany etc- where as previously without eager loading automatically they would work.

This means tests would begin to fail.

I've added a test for this behavior & removing the HasEvent changes I've made it fails.

The logic I've added removes any relations that have been set as null before the creating event, and call the eager loading chain again meaning those relations will be set properly. Because it's the first event called (I believe) it means other events no longer suffer this too.

Perhaps there's a better way, but open to ideas.

Copy link

github-actions bot commented Jul 3, 2025

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@jackbayliss jackbayliss marked this pull request as ready for review July 3, 2025 22:26
@jackbayliss jackbayliss closed this Jul 3, 2025
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.

1 participant