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: How to output amf as a viewcomponent?  (Read 9188 times)
toby869
Newbie
*
Posts: 8


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

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 Email
« Reply #1 on: December 16, 2011, 07:28:44 »

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 Email
« Reply #2 on: January 05, 2012, 11:18:37 »

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