laravel-mongodb
laravel-mongodb copied to clipboard
[Fix] MorphTo relationship returns null when eager loaded if target model has different primary key
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
Hello @yahyaizhar. Thanks for contributing this bugfix. Would you be able to add a test showing the bug, to avoid any regression?
Tracked in Jira to get time to review this PR and add tests: PHPORM-175