PDA

View Full Version : [3.0] Thoughts about an Ext.Direct router for Symfony



jesse.dhillon
15 Apr 2009, 6:58 PM
This thread is about Ext.Direct and Symfony. If this is not the right place for this post, please direct me to a better forum.

Since learning about the new Ext.Direct functionality I've been considering how to implement a router in Symfony. For anyone not familiar, as I understand it the requirements are thus:

A request will come in as a serialized array of transaction objects. Each object will have a transaction id and will specify the controller and action to which this request is to be routed. It will also contain zero or more arguments to supply to that controller/action pair.

A router will have to process these transactions by routing them to the actions which will act upon them, then taking any return values from those actions and returning them in a transaction response object which has the id of the transaction to which the object is responding.

So with that in mind I have been considering how best to implement a router in Symfony. So far I've thought that using factories.yml to override the controller class is the best way. The new controller class would have a dispatch() method that would detect somehow whether or not this is a request from Ext.Direct.

I think a reasonable approach to signaling the server that the request is coming from Ext.Direct would be to set an HTTP header like so: 'X-Requested-With: Ext.Direct' or something to that effect.

I haven't looked at 3.0 yet to see how this would be done but I assume that changing the prototype of some object somewhere would be enough to set a default header.

Are there any Symfony users out there? Anyone have any thoughts about this? Thanks in advance.

mystix
17 Apr 2009, 7:32 PM
[ moved to Open Discussion from 2.x Ux and Plugins ]

smokeman
20 Apr 2009, 6:35 AM
looking at migrating to symphony from hand coded php, so I like the idea.
does symphony work well with extjs app development?

mjlecomte
20 Apr 2009, 6:38 AM
Not sure why the OP didn't indicate what Symfony is:
www.symfony-project.org/

dancablam
22 Apr 2009, 10:18 AM
Hi Jesse,

I'm working on a extjs router plugin for symfony and should have a beta version available in a couple weeks. If you would like to assist that would be excellent.

I'm waiting on official router specs from the ext team which they mentioned they'd publish soon. Aside from that I am also trying to determine the best method to integrate the router with symfony so that it can integrate with existing applications and so the performance is acceptable.

Since all ext router requests go to a single url (ie /myapp/mymodule/router) there should be no need to add an HTTP header to diferentiate a router request from another request. Instead you can simply put a reference to a "symfonized" router class in the appropriate action class.

I'll keep you posted and if you (or any other ext+symfony devs) like to further collaborate with me on a symfony plugin please PM me and I'll send you my email address and skype id.

Cheers,
Dan

dancablam
4 May 2009, 7:40 AM
Here's the symfony plugin:

http://www.extjs.com/forum/showthread.php?p=324854#post324854

Cheers,
Dan