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

Pages: [1]
Print
Author Topic: ONE PROXY, TWO VO´S  (Read 10956 times)
Vander
Full Member
***
Posts: 32


View Profile Email
« on: September 21, 2008, 09:05:20 »

hi... im near finish my first great system using puremvc... its very good to work with flex3/pmvc/amfphp/eclipse bla bla ;D

ive a doubt

whats the best way to work with more than one vo, in a proxy?

because super initializes the "first one", so i can use setData(vo)

but
im needing to use one more VO... how its the best approx?

thanks.
Vander.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: September 22, 2008, 04:52:09 »

Are these VOs of the same type if so just use an ArrayCollection as the Proxy's data object and put the VOs in the collection.

Otherwise, are the VOs truly so interrelated that you need the same Proxy to handle them? Does the Proxy need to update one whenever the other changes or something? If not perhaps consider two separate Proxies.

-=Cliff>
Logged
Sammi
Courseware Beta
Full Member
***
Posts: 45


View Profile Email
« Reply #2 on: October 22, 2008, 01:37:36 »

Hmmmm,

so you recommend that each Proxy is usually only managing a single VO?

I put all kinds of properties (vo's or not) in the proxy and provide getters and setters to them.

Best,
Sammi
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: October 23, 2008, 05:07:25 »

Well toy can do this but often that leads to prickly code at the mediator where you're pulling 10 properties off a Proxy and setting them on the view component. Or worse, giving a Proxy reference to the view component.

That's what VOs are for. Wadding up a bunch of related props and tossing them over to another tier.

So its best to have one VO or a collection of the same type as data object for the Proxy.

Adding getters and setters to the Proxy that manipulate the VO is ok, and its also often the case that XML is used instead of a VO, since E4X can make the Proxy's life easier at filtering or querying its data.

-=Cliff>
Logged
marek
Jr. Member
**
Posts: 14



View Profile WWW Email
« Reply #4 on: November 07, 2008, 07:24:08 »

Hi guys.

Got similar problem some time ago and did use 3 diferent VO sending to my GameProxy that provides me a configuration for whole application.
Becouse I was migrating to pureMVC from old version of these application didn't want to create 5 separate proxies. Whole config contains sets of data that came from diferent places. Data is used across whole application so I did grouped it and and now access it by:

first retrieving a proxy
:
var gameProxy: GameProxy;
gameProxy = facade.retrieveProxy( LoginProxy.NAME ) as LoginProxy;
and then simple:
:
gameProxy.stage;and diferent group (internal object):
:
gameProxy.config.url;
gameProxy.config.assetsURL;
gameProxy.config.gatewayURL;
gameProxy.config.sessionURL;
gameProxy.config.serviceName;
gameProxy.config.loaderinfo;
and next one:
:
gameProxy.acc.loggedin;
gameProxy.acc.accountid;
gameProxy.acc.lastactionid;

etc...
the VO objects are strored in app.model.common.vo
Logged
Pages: [1]
Print