Is there an automatic way to cast a variable in a custom object as
ArrayCollection from a CFC service call? How about nested
ArrayCollections also? Something like how <cfquery> automatically casts.
Below is an example of custom objects where the AS classes are mapped
via RemoteClass to the CFCs (built with the CF Wizard). I would like
to do a simple assignment like var myAccount:Account = new Account(
event.result );
AS Classes:
package vo
{
[RemoteClass(alias="com.theSite.Account")]
[Bindable]
public class Account {
public var id:Number = 0;
public var name:String = "";
public var orders:ArrayCollection = null; //order objects
}
}
package vo
{
[RemoteClass(alias="com.theSite.Order")]
[Bindable]
public class Order {
public var id:Number = 0;
public var total:Number = 0;
public var orderDate:Date = null;
}
}
CFCs on Server:
<cfcomponent output="false" alias="com.theSite.Account">
<cfproperty name="id" type="numeric" default="0">
<cfproperty name="name" type="string" default="">
<cfproperty name="orders" type="Array" default="Order[]">
...
</cfcomponent>
<cfcomponent output="false" alias="com.theSite.Order">
<cfproperty name="id" type="numeric" default="0">
<cfproperty name="total" type="numeric" default="">
<cfproperty name="orderDate" type="date" default="">
...
</cfcomponent>
Thanks