Question
How can I acheive this technique with CFC's?
Hi,
I'm building a CMS type thing, and for my templates I'll need access to some functions that do certain things so I can output the various data I need. At the moment, I have separate methods in a component that do individual things - they do not work together in any way. However, what I thought would be nice, is to find a way where I can use these CFC's together.
e.g. If I had a method that got user details based on an ID passed as an argument, I would like to have a way that perhaps gets there billing details if I want...or whatever is in there basket etc. The normal way I would do this is to write many completely different methods for a specific purpose.
Is there a way to do something like:
#getUserDetails("3434").getOrderHistory().getProduct("78")#
By that kind of syntax (which is probably completely wrong), I'd like to say:
Get the user details with an ID I pass to the getUserDetails method, then with this, get the order history via a CFC called getOrderHistory (which would use the ID in getUserDetails and then when I have this, get a specific product from the getOrderHistory based on another ID of the product. This would all then probably return some kind of structure or array that I can loop and do with what I like.
Is this kind of functionality possible in Coldfusion? I don't even know what I'd call this method / technique.
I want to become a better Coldfusion user - so any advice would be very welcome.
Thanks,
Mikey.
I'm building a CMS type thing, and for my templates I'll need access to some functions that do certain things so I can output the various data I need. At the moment, I have separate methods in a component that do individual things - they do not work together in any way. However, what I thought would be nice, is to find a way where I can use these CFC's together.
e.g. If I had a method that got user details based on an ID passed as an argument, I would like to have a way that perhaps gets there billing details if I want...or whatever is in there basket etc. The normal way I would do this is to write many completely different methods for a specific purpose.
Is there a way to do something like:
#getUserDetails("3434").getOrderHistory().getProduct("78")#
By that kind of syntax (which is probably completely wrong), I'd like to say:
Get the user details with an ID I pass to the getUserDetails method, then with this, get the order history via a CFC called getOrderHistory (which would use the ID in getUserDetails and then when I have this, get a specific product from the getOrderHistory based on another ID of the product. This would all then probably return some kind of structure or array that I can loop and do with what I like.
Is this kind of functionality possible in Coldfusion? I don't even know what I'd call this method / technique.
I want to become a better Coldfusion user - so any advice would be very welcome.
Thanks,
Mikey.
