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.
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.