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

[Fix] MorphTo relationship returns null when eager loaded if target model has different primary key #2786

Open
wants to merge 1 commit into
base: 4.2
Choose a base branch
from

Conversation

yahyaizhar
Copy link

This will fix #2783

$this points to current model i.e. source model. But the $ownerKey should be primary key of target model
Leaving $ownerKey as null will fix the issue

Checklist

  • Add tests and ensure they pass
  • Add an entry to the CHANGELOG.md file
  • Update documentation for new features

@yahyaizhar yahyaizhar requested a review from a team as a code owner March 18, 2024 18:52
@yahyaizhar yahyaizhar requested a review from GromNaN March 18, 2024 18:52
@GromNaN
Copy link
Member

GromNaN commented Mar 19, 2024

Hello @yahyaizhar. Thanks for contributing this bugfix. Would you be able to add a test showing the bug, to avoid any regression?

@GromNaN
Copy link
Member

GromNaN commented Apr 26, 2024

Tracked in Jira to get time to review this PR and add tests: PHPORM-175

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.

MorphTo relation won't work when eager load if target model has different primary key
2 participants