Is it possible in ColdFusion that a non-persistent property could have a dynamic value?
An example would be
Item.cfc
property name="myID" length="100" type="string" fieldtype="id" generator="guid";
property name="hasImageFlag" persistent=false default="{isNull(getItem().getIcon())};
property name="Icon" fieldtype="many-to-one" fkcolumn="imageID" cfc="image" lazy="true";
So in this example hasImageFlag could just be isNull(getItem().getIcon()) which would return true or false.
No, you cannot do that in cfproperty. For two reasons.
It simply does not allow a dynamic default. So you can’t even do default=”#arrayNew(1)#”
In your case, the getItem() method of this class will not exist yet while this code is running.
When I have needed dynamic defaults, I have done it in the init() constructor method so that it happens immediately after the object is created.