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

PHPORM-175: Use foreign key name for MorphTo relationships #3011

Merged
merged 4 commits into from
Jun 20, 2024

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented Jun 19, 2024

https://jira.mongodb.org/browse/PHPORM-175

Incorporates the proposed solution in #2783 to not default $ownerKey to the current model's key name when constructing a MorphTo in HybridRelations::morphTo().

That change alone caused RelationsTest::testMorph() to fail, since MorphTo::addConstraints() would attempt to use a null ownerKey value. This required an additional change to fall back to the foreign key name when building the constraint.

Checklist

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

Incorporates the proposed solution in mongodb#2783 to not default $ownerKey to the current model's key name when constructing a MorphTo in HybridRelations::morphTo().

That change alone caused RelationsTest::testMorph() to fail, since MorphTo::addConstraints() would attempt to use a null ownerKey value. This required an additional change to fall back to the foreign key name when building the constraint.
@jmikola jmikola requested a review from a team as a code owner June 19, 2024 03:16
@jmikola jmikola requested review from alcaeus and GromNaN June 19, 2024 03:16
tests/Ticket/GH2783Test.php Outdated Show resolved Hide resolved
tests/Ticket/GH2783Test.php Show resolved Hide resolved
@jmikola jmikola merged commit 8333880 into mongodb:4.5 Jun 20, 2024
26 checks passed
@jmikola jmikola deleted the 4.5-phporm-175 branch June 20, 2024 19:28
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.

2 participants