Fix Belongs To Morphed behavior for custom ways#556
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 2.x #556 +/- ##
=========================================
Coverage 91.75% 91.75%
- Complexity 1963 1965 +2
=========================================
Files 131 131
Lines 5034 5036 +2
=========================================
+ Hits 4619 4621 +2
Misses 415 415 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔍 What was changed
Now, for
BelongsToMorphedrelations, you can legally manually specify themorph_typecolumn (withoutmorph_id). This won't work if the entity is not new and the relation was set tonullin this EM transaction (in this case, all relation fields will be prioritized tonull).🤔 Why?
Cycle ORM allowed some flexibility for the programmer. The recent fix that reset related fields broke some existing project codebases. To fix this, the old behavior was restored and supported with tests.
Even though this behavior is backed by tests, we still recommend not doing it this way for best practice reasons.
📝 Checklist