[#14810] Call model setters during ORM hydration in cloneResultMap()#16906
Merged
niden merged 4 commits intophalcon:5.0.xfrom Apr 23, 2026
Merged
[#14810] Call model setters during ORM hydration in cloneResultMap()#16906niden merged 4 commits intophalcon:5.0.xfrom
niden merged 4 commits intophalcon:5.0.xfrom
Conversation
Jeckerson
approved these changes
Apr 23, 2026
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.
Hello!
In raising this pull request, I confirm the following:
Small description of change:
Root Cause
cloneResultMap()— used internally byfindFirst(),find()and all hydration paths — was directly assigning DB values to model properties, bypassing any user-defined setter methods (e.g.setName()). This was inconsistent withassign(), which respects setters.Fix
Added the same setter-checking logic as
assign()to all three property-assignment paths incloneResultMap(), gated by the existingorm.disable_assign_setterssetting (defaultfalse, meaning setters are called). Internal Phalcon setters listed inlocalMethods(e.g.setDirtyState,setSource) are excluded to avoid interference with the ORM's own lifecycle.Files Changed
phalcon/Mvc/Model.zep— setter-calling logic added tocloneResultMap()at all three assignment pointstests/support/Models/InvoicesWithSetters.php— new test support model with setters that transform valuestests/database/Mvc/Model/CloneResultMapTest.php— newtestMvcModelCloneResultMapCallsSetterstest (alphabetically ordered)CHANGELOG-5.0.md— added entry for [BUG]: Model setters do not call during hydration #14810Thanks