Did you know that you can specify in your returnType for a component method that it returns not just a component, but an array of components? To specify that you want to return a component of type Apple, you would normally do this:
returnType="Apple"
to specify an array of Apples, you simply do:
returnType="Apple[]"
You can also specify the same thing in cfargument. Here is an example:
<cffunction name="getApples" returnType="apple[]" output="false" access="remote"
hint="Get me some darn apples.">
<cfset var i = "">
<cfset var result = arrayNew(1)>
<cfloop index="i" from="1" to="10">
<cfset arrayAppend(result, createObject("component", "apple"))>
</cfloop>
<cfreturn result>
</cffunction>
<cffunction name="setApples" returnType="void" output="true"
hint="Just give me some apples.">
<cfargument name="appleData" type="apple[]" required="true">
<cfdump var="#arguments.appleData#">
</cffunction>
</cfcomponent>
Note: There is a bug with the built-in component viewer. It shows the type as Apple[], and when you click on it, you get an error. I had planned to do some updates to the component viewer so I will fix that as well. I need to ask Macromedia if I can then simply package the entire zip. (Technically it would be a copyright violation, but I'd have to have to package up my changes as a bunch of things to cut and paste.)