Generated accessors

As described in Define ORM mapping, the persistent fields for an object are defined in the CFC using cfproperty. ColdFusion generates the accessor methods (getter and setter) for each property in the CFC that can be invoked. For more information, see Implicit Get and Set Functions. For example, if a property is defined in Artist as follows:
<cfproperty name="firstName" >
There are two methods generated in the Artist object:
  • setFirstName(firstName)

  • getFirstName()

You can invoke these methods like regular methods in the CFC. For a property, the generated setter saves the value for the property in the object's VARIABLES scope. The generated getter retrieves the value of the property from the VARIABLES scope. ORM always uses the property value from the VARIABLES scope. That is, while saving the object's data in the table, ORM retrieves the value of the property from VARIABLES scope. While populating the object after reading from the table, ORM puts the property's value in the VARIABLES scope.If you define your own accessor methods for a property, store the property value in the VARIABLES scope for ORM to access it.