Is it possible to pass arguments to a entity in ORM like my example below? I was hoping something like this would work…..
pass in args
entityNew(arguments.entityName).init(valueHere);
then get it here in the entity init() function.
property name="ID" type="string" fieldtype="id" generator="guid";
property name="val1" type="string" ormtype="string" persistent=true;
property name="val2" type="any" persistent=false default="";
public statsEntity function init(){
// do something with it
variables.val2= arguments.value;
return Super.init();
}
The init function will run by default.
As of ColdFusion 9.0.1 you can do this:
You could also use the new operator, which also runs the init if exists, although you need the full path: