Casts feature does not work on getters

Description

When specifying `casts="boolean"` it will return the property as a boolean in a memento, but not with a getter. Also, `get_casts()` does show the property as listed as boolean.
I have attached the `qRegisteredPlayer.cfc` as well as the output from the following code:

 

Environment

None

Activity

Show:
Samuel W. Knowlton
July 31, 2019, 2:21 PM

I’m also interested to know why this functionality is tied to a separate attribute casts rather than type. The whole problem of dealing with 0/1 true/false yes/no between database grammar and Cold-Truthy-Fusion is a nuisance, so I get why some special handling is needed, but it seems like if you don’t care how CF treats the value, you just leave out type; but if you type it as a boolean, you’re expecting true or false any time you get the property. casts as a separate attribute seems redundant.

Eric Peterson
January 3, 2020, 3:44 AM

The idea behind casts is that it would also enable value wrappers, like a Date value object or a Money value object.

Additionally, I don’t use accessors so type doesn’t do anything for me. Even if it did, I don’t usually type properties. ¯\_(ツ)_/¯

Fixed

Assignee

Eric Peterson

Reporter

Andrew Davis

Labels

None

Priority

Major