Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

| * |

  Show Posts
Pages: [1]
1  Announcements and General Discussion / Architecture / Call proxy from VO? on: July 15, 2011, 12:16:34
Is it bad or OK to call a proxy from a VO?

If it's not OK, why not?

Let's say I have two different proxies, one for cars and another for car parts used on different cars. If I open a car part I will have the ID to the car it fits on, so why can't I retrieve the car proxy in the VO and return the related car VO right there?

:
package com.carparts.model.vo {
public class CarVO {
public var IDCar:int;
public var Brand:String;
public var Wheels:int;
public var Color:String;
}
}

package com.carparts.model.vo {
import com.carparts.ApplicationFacade;
import com.carparts.model.CarsProxy;

public class PartVO {
public var IDPart:int;
public var IDCar:int;
public var Price:Number;
public var Size:Number;
}

public function get car():CarVO {
// The CarsProxy has a dictionary of all different cars indexed by IDCar.

var carsProxy:CarsProxy = ApplicationFacade.getInstance().retrieveProxy(CarsProxy.NAME) as CarsProxy;
return carsProxy.carsDictionary[IDCar];
}
}
Pages: [1]