laravel-mongodb icon indicating copy to clipboard operation
laravel-mongodb copied to clipboard

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

Open yahyaizhar opened this issue 3 months ago • 2 comments

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 avatar Mar 18 '24 18:03 yahyaizhar

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

GromNaN avatar Mar 19 '24 17:03 GromNaN

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

GromNaN avatar Apr 26 '24 10:04 GromNaN