PureMVC Architects Lounge

Announcements and General Discussion => Architecture => Topic started by: wssbwssb on May 21, 2009, 10:39:04



Title: Hi, an complex Vo question
Post by: wssbwssb on May 21, 2009, 10:39:04
Hi,

I created two Vo.

   Class BookVo
   {
      public var name:String
      public var type:BookTypeVo;
   }

    class BookTypeVo
    {
        public var name:String
        public var name:String
    }

BookVo has a BookTypeVo as it's property.
When I start my app.I created two proxies named BookProxy and BookTypeProxy to manager the two type of vos.

The question is when I create BookVo instance, I need a BookTypeVo instance.
Is it better to retrieve BookTypeProxy in BookProxy directly?
Or should I create a command to handle the BookVo's creation?

Thanks.


Title: Re: Hi, an complex Vo question
Post by: puremvc on May 22, 2009, 04:47:53
You might want to do the assembly in a command to keep it loose. There's nothing wrong with accessing other proxies from within a proxy, but you rely on the app to have registered them unless you do that registration in the parent proxy.

In this case you could create and register the BookTypeProxy in the onRegister method  of the book proxy. Keep a local reference to it in the book proxy if you'd like.

-=Cliff>