As designed getEntitySourceValue is called twice per column on saving

Xon

Well-known member
Affected version
2.0 Beta 3
In XF\Mvc\Entity\Entity::save(), _saveToSource is called which loops over each to-be-saved column and calls getEntitySourceValue. This function then returns the saved array.

Later in save(), this process is repeated to populate an array to pass to _saveCleanUp, which has already been computed.
 
There's actually an edge case reason for this, though I'll add a comment to mention this. It's actually possible for the _newValues array to change between these times due to calls like fastUpdate() and setAsSaved(), which don't write into _values if we are in the process of doing an insert/update.
 
Back
Top Bottom