Yii and Flex 3

Hi all! I want to discuss about Yii and flex a bit. For the last time to make the Flex application with PHP background I’ve used as3corelib in flex and JSON php methods. http://blog.paranoidferret.com/?p=23 - here I’ve found an example on which I then make my flex applications. But in Yii I see the SOAP service very usefull for flex&php. But I see that I can’t use some caching methods for SOAP. The SOAP service in Yii is faster one then in Prado, but I don’t sure for using it in big flex applications because of it perfomance. Can anybody give my an explanation on when SOAP is usefull and how can I realise in Yii the approach with as3corelib and JSON? Thanks.

They are different approaches. JSON is a serialization method and it is typically used in a RESTful way, which has lower overhead than SOAP. The advantage of SOAP is that it better abstracts the way you implement and use the Web service.

I used SOAP in a quite large Web application with thousands of users and very large data set (nearly 1GB). It seems to me in most cases the performance bottleneck is in DB query, rather than SOAP.

Did Yii SOAP service suitable for complex AIR application with huge db background?

Yii SOAP is very light encapsulation of PHP SOAP. So if you believe PHP SOAP is suitable, Yii SOAP should too.

I would suggest to use AMFPHP. You can sets the AR directory as the classmapping path in AMFPHP thus you get native AS3 Objects on the flash site.

You can also use the c extension to speed things up.

While amfphp gets deprecated i would suggest one use SabreAMF to write a component or dunno what it is called in yii to be the gateway.

We created a webshop with flex admin gui, integrated using AMFPHP.

We used activerecords. All objects wich extended the activerecord object was unable map at flex side, it arrived as "generalobject".

All other object mapped well.

Did u noticed such behavior?

I never used Flex, but I’ll have to create such an interface.

Create an AMF compliant webapp

Do you have some ticks to make a classic Yii webapp, Flex/AMF compliant ?

Is there a way to manage the controller methods as we can do for SOAP in Yii ?

Do I have to

  • create a file like gateway.php with a method such Yii::createAMFApplication($config)->run() (extending CWebApplication) as Zend_AMF_Server ?

  • or

  • create a gateway like CWebServiceAction and a CComponent like CWebService for SOAP ?

  • or anything else (extending CController) ?

Choose the framework

I read that

[indent]If you are a beginner or you are looking for a very complete out of the box AMF solution, I would definitely advice to use AMFPHP or WebOrb [instead of SabreAMF]. Its pretty much install-and-go with those products.



And what about Zend_AMF or (the dead) CakePHPAMF?

Thanks for your comments

In AS3 you need to register all MappingClass with "registerClass()" otherwise they will not be compiled in the swf file because the compiler does not find any references in your code and skips them.

Thanks for your reply, but I’m not aware of AS3 and Flex.

First, I’m wondering how easy I can add an AMF communication to my controller methods.

is a similar way of the Zend example at bottom of http://code.google.com/p/sabreamf/wiki/FAQ able :

  • Create an extended CController class

  • add only one indexAction, which run the SabreAMF server

  • the callback method asks for the right method

  • the callback method converts return values of methods

Then, I’ll have to understand how I can handler authentication, I read in the SabreAMF doc that cookies do not work. http://code.google.com/p/sabreamf/wiki/Authentication

Thanks for your clarifications

Did you have any luck getting this to work? I’m interested in doing the same. Any feedback would be greatly appreciated.