var modelingDataResponder:IResponder = new ModelingDataResponder();
var modelingDataService:DataService = EnterpriseServiceLocator.getInstance().getDataService("ModelingDataService");
var token:AsyncToken = modelingDataService.fill(myModel, clientName);
This causes the variable myModel to be filled. It adds a responder called modelingDataResponder which implements IResponder. modelingDataResponder is called when the fill completes.
My question is this. modelingDataResponder is called with data that's a copy of the myModel object that was filled. But it seems to be only a copy. It seems like executing code inside modelingDataResponder that changes data fields inside the parameter that is passed in just changes the data in a local copy, not in the myModel object that was filled. The two objects have separate addresses when looked at in the debugger, and changing a value in one has no effect on the other.
So it's like the data that is passed back is a copy. The copy can be read. Writing in the copy is OK, but it is just writing on a copy, on on the object that was filled. Right?
I think that this is a bug... I think that today the responder's token is receiving the raw array of objects received from the server. It should be given the same object - i.e. the "myModel" object -- in the result event. I'll make sure a fix gets into the next release. In the meantime, a workaround would be to do:
token.myResult = myModel
just after the fill call... then use "myResult" instead of token.result.