> So am I to understand correctly...that you can ONLY chain methods that
> return "this"? Or that if your init function returns an object then all
> methods can be chained? I'm reading all of this conversation as the former
> (the first one) meaning that if you WANT to be able to chain a method,
> that
> method needs to return "this".
If you want to chain method calls on the same object, all of the methods in
question must return "this":
person.setFirstName("Sean").setLastName("Corfield")
In this example, you have a person component with methods setFirstName and
setLastName. Each of those methods is returning "this". The long way to
accomplish the above is:
person.setFirstName("Sean")
person.setLastName("Corfield")
In the other example posted, multiple CFCs are involved:
Name = Session.SessionCFC.getUserCFC().getName()
In this example, the getUserCFC() method belongs to the SessionCFC
component. It is returning a UserCFC component, not "this". The getName()
method belongs to the UserCFC component, not the SessionCFC component.
The longer way to accomplish the above would be:
User = Session.SessionCFC.getUserCFC()
Name = User.getName()
Ben Rogers
http://www.c4.net
v.508.240.0051
f.508.240.0057
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - CFDynamics
http://www.cfdynamics.com
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:188937
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54