Skip to content

Fix Belongs To Morphed behavior for custom ways#556

Merged
roxblnfk merged 4 commits into2.xfrom
btm-behavior
Mar 5, 2026
Merged

Fix Belongs To Morphed behavior for custom ways#556
roxblnfk merged 4 commits into2.xfrom
btm-behavior

Conversation

@roxblnfk
Copy link
Member

@roxblnfk roxblnfk commented Mar 5, 2026

🔍 What was changed

Now, for BelongsToMorphed relations, you can legally manually specify the morph_type column (without morph_id). This won't work if the entity is not new and the relation was set to null in this EM transaction (in this case, all relation fields will be prioritized to null).

🤔 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

  • How was this tested:
    • Tested manually
    • Unit tests added

@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.75%. Comparing base (ddded1e) to head (dedb5a6).
⚠️ Report is 1 commits behind head on 2.x.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@roxblnfk roxblnfk merged commit 2c06029 into 2.x Mar 5, 2026
28 of 30 checks passed
@roxblnfk roxblnfk deleted the btm-behavior branch March 5, 2026 11:59
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.

1 participant