You can chain your CFC methods as follows:

emp=new employee();

Chaining works only

  • If the attribute accessors is set to true
  • Until a method is found
  • If there are no errors
  • If the setter functions for the properties are defined


The chain in the example works only until lastName. This is because setter for age is set to false:

<cfcomponent accessors="TRUE">
<cfproperty name="firstname" type="string" setter="true"/>
<cfproperty name="lastname" type="string" setter="true"/>
<cfproperty name="age" type="numeric" setter="false"/>
<cffunction name="init">
<cfreturn this>

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy