This content has been marked as final. Show 3 replies
You're not calling the COMPONENTS, you're calling the methods within the
components, which are all different. So if you need all those methods
called, then yes, you... do... have to call them.
You could cut down the number of keystrokes and make your code more
readable if you used CFScript instead of CFML, eg:
<cfinvoke component="#Students#" method="ListStudents"
ListStudents = Students.ListStudents(argumentcollection=Form);
The other thing you could do is to to write one more method called
doesItAll() (or something), in which you stick all that code, and
doesItAll() takes only those few arguments needed to all those method
calls, and returns one struct with all the results in it:
stResult = Students.doesItAll(argumentCollection=Form);
<cffunction name="doesItAll" returntype="struct" output="false">
var stReturn = structNew(argumentcollection=arguments);
stReturn.ListStudents = ListStudents(argumentcollection=arguments);
stReturn.GetAddress = GetAddress(argumentcollection=arguments);
stReturn.GPA = GPA(argumentcollection=arguments);
stReturn.Education = Education(argumentcollection=arguments);
stReturn.GetComments = GetComments(argumentcollection=arguments);
stReturn.Academic = Academic(argumentcollection=arguments);
stReturn.LSAT = LSAT(argumentcollection=arguments);
(note: this omits the call to the "image" component, which would still need
to be done separately)
<cfobject> or createobject would entail less code. Plus, you could write an init() method in your students.cfc that processes the form variables and makes cfc variables available to all the functions contained therein.
I will look into creating something like a doesItAll. I do use the cfobject
I just didn't include that in the page cut.