coldbox-modules / quick

A ColdBox ORM Engine
https://quick.ortusbooks.com
MIT License
23 stars 19 forks source link

[Quick 7] Regression: No Longer Preserving Casted Value After Saving Entity #203

Closed homestar9 closed 3 months ago

homestar9 commented 1 year ago

In 4.1.1, 4.1.2, Quick was updated to preserve casted values after saving. However, in v5 (as of 5.2.1), Quick no longer preserves the value.

How to replicate

// create entity that uses any cast (e.g. BooleanCast@quick)
property name="foo" casts="BooleanCast@quick";

// in your handler, set the value to "0" (a string representation of 0)
getInstance( "myEntity" ).setFoo( "0" );

// dump out the memento
writeDump( serializeJson( myEntity.getMemento() ) ); // foo will be "0"

// persist the entity
myEntity.save();

// dump out the memento
writeDump( serializeJson( myEntity.getMemento() ) ); // foo will still be "0" in Quick 5, but will be false in Quick 4

Quick 4 handles the cast properly when persisting, but Quick 5 doesn't seem to recast anymore.

Quick 4: image

Quick 5: image

homestar9 commented 10 months ago

This issue still persists from Quick 5 through current as of today, Quick 7.2.0

homestar9 commented 3 months ago

Can confirm this was fixed in Quick 9.0.0