Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Welcome, Guest. Please login or register.
June 26, 2017, 03:19:44 PM
Home Help Search Login Register
News: Please DM @puremvc on Twitter to gain forum access. Spambots are why we can't have nice things.
Pages: [1]
Print
Author Topic: How to output amf as a viewcomponent?  (Read 3307 times)
toby869
Newbie
*
Posts: 8


View Profile
« on: December 15, 2011, 02:32:40 PM »

I'm writing a basic API to some backend settings and I would like to return the results in different formats (xml, html, etc) for different frontends to consume.  How would I go about outputting amf?

I can think of three different routes (and none seem like they would be feasible)..

Wrap the facade within the services class...and somehow return data from the viewcomponents?

Create the gateway/services and pass that into the API to be used as a viewcomponent...and somehow still be able to access it properly as a remote object?

Something like this: http://efreedom.com/Question/1-1942890/Self-Contained-Library-Serializing-PHP-Data-AMF where I basically have to format the amf output myself.


Any ideas greatly appreciated!
Logged
toby869
Newbie
*
Posts: 8


View Profile
« Reply #1 on: December 16, 2011, 07:28:44 AM »

After a lot more reading last night I realize this wasn't really a feasible question.  AMF isn't just a format, it's also how the messages are sent and received.  Technically, I could implement the serialization in the viewcomponent, but I would also have to address the RPC portion as well (like SOAP or REST).
Logged
omar
Newbie
*
Posts: 9


View Profile
« Reply #2 on: January 05, 2012, 11:18:37 AM »

AMF is an encoding protocol to get PHP objects serialized for AS3 and vice versa. Ideally, you should create your PHP model classes so they return plain PHP objects with the data you need. For AMF you can then use the model class to get the PHP data objects and return them via AMF so they're serialized, fo XML  you could do the same and take the PHP data and translate it to XML before returning the XML output. Does that make sense?
Logged
Pages: [1]
Print
Jump to: