From: Evert | R. <ev...@ro...> - 2008-10-28 22:47:17
|
The AMF protocol does allow object references, as long as they're in the same packet. So this will not work on multiple requests. There's two howevers: * While a PHP implemention (amfphp) can autodetect it, it is a heavy process as it requires looping through all the objects to see if an object was already used. Now, this could be done using a hashmap.. but not extremely straightforward * You know how your business logic works and what a reference (to a category/id or otherwise) works from a logic perspective. Generally you'd want to avoid any automatic 'magic' and simply supply category id's, and make the references manually. Novice developers love automatic behavior (Classmapping also falls into this category for me) but manual, predictable behavior often produces more maintainable and less error-prone results. </endofrant> Evert On 28-Oct-08, at 4:55 PM, Jonathan Valliere wrote: > It is my understanding that the Native Flash Objects are assembled > automatically in the Flash player based on the AMF data sent. Just > as if you had a custom XML-based object representation and a > parser. Therefore there wouldn't be such a way to do runtime memory > referencing unless the protocol supported it explicitly. > > > On Oct 28, 2008, at 10:27 AM, João Saleiro wrote: > >> Hello, >> >> imagine the following scenario: >> >> - backend in AMFPHP; >> - a remote procedure that returns a complex type: >> >> Categories[] >> CategoryVO (#12334) >> id: 1 >> name: Accounting >> etc... >> CategoryVO (#34221) >> id: 2 >> name: Reporting >> etc... >> >> >> >> - Another remote procedure that returns another complex object: >> >> UserVO (#5456) >> id: 1 >> name: John Doe >> CategoryVO (#2145) >> id: 2 >> name: Reporting >> >> The category of the user John Doe is "Reporting", id 2. It's the >> same previously returned by the other service, on the position 1 of >> the categories array. The problem is that, on the client side: >> >> categories[1]==user.category >> >> is false. It's the same category, the problem is that when the >> object mapping occurs on the client side, it creates a new >> reference, so they are different instances of the same object. >> Right now, we need to make some loopings on the client-side to find >> and replace references. This involves a lot of work, and has >> performance considerations. >> >> Is it possible, or is there a solution to make same objects >> returned from the server side have same references on the client >> side? >> >> Thanks, >> >> João Saleiro >> >> CTO @ Webfuel >> Adobe Community Expert >> Co-founder of the Portuguese RIA Community >> >> <btn_profile_greytxt_80x15.gif> >> _______________________________________________ >> osflash mailing list >> os...@os... >> http://osflash.org/mailman/listinfo/osflash_osflash.org > > _______________________________________________ > osflash mailing list > os...@os... > http://osflash.org/mailman/listinfo/osflash_osflash.org |