coldbox-modules / quick

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

[Quick 7] Casts No Longer Work With Discriminated Entities #233

Open homestar9 opened 1 year ago

homestar9 commented 1 year ago

I discovered an issue when playing around with discriminated entities where casts no longer work, specifically the JsonCast@quick.

If I assemble the entity like this, casts work:

component 
    extends="quick.models.BaseEntity" 
    accessors="true"
    table="MaintenanceTask" 
{

    property name="data" casts="JsonCast@quick"; 

Output: "data":{"rowsDeleted":0,"targetDate":"June, 25 2023 13:15:59"}

If I assemble the root entity like this, casts don't work:

component 
    extends="quick.models.BaseEntity" 
    accessors="true"
    table="MaintenanceTask" 
    discriminatorColumn="name"
    singleTableInheritance="true"
{

    property name="data" casts="JsonCast@quick"; 

Output: "data":"{\"rowsDeleted\":0,\"targetDate\":\"June, 25 2023 13:17:27\"}"

Note: I tested this issue all the way back to Quick 5 and can replicate it.

bdw429s commented 1 year ago

This issue has been mentioned on Ortus Solutions Community. There might be relevant details there:

https://community.ortussolutions.com/t/using-discriminated-entities-when-the-base-class-has-no-knowledge-of-child-classes/9728/6

bdw429s commented 4 months ago

This issue has been mentioned on Ortus Solutions Community. There might be relevant details there:

https://community.ortussolutions.com/t/using-discriminated-entities-when-the-base-class-has-no-knowledge-of-child-classes/9728/8