[symfony-users] Re: Routing-Rules: use sf_format only as an optional value

2009-05-26 Thread Gábor Fási

This is how it's done in jobeet, day 15:

// apps/frontend/config/routing.yml
category:
  url: /category/:slug.:sf_format
  class:   sfPropelRoute
  param:   { module: category, action: show, sf_format: html }
  options: { model: JobeetCategory, type: object }
  requirements:
sf_format: (?:html|atom)


On Tue, May 26, 2009 at 12:04, halla dha.maili...@googlemail.com wrote:

 Hi everybody,

 I'm using different routes for my application, which also determine
 the response format (xml or json for an REST-based web service).

 This is an example rule in routing.yml:

 user_me:
  url:                  /user/me.:sf_format
  params:               { module: user, action: getUserMe }
  requirements: { sf_method: GET, sf_format: (?:xml|json) }

 Is there a way to set sf_format to XML if NO .xml|json is given in the
 URL (the Suffix should be optional)? So that this ressource can be
 called via the  following URLs:

 (1) /user/me.xml - XML-Response
 (2) /user/me.json - JSON-Response
 (3) /user/me - XML-Response

 Actually, a 404 is raised by symfony if the ressource is called via
 (3).

 Thanks for your help in advance,
 Daniel
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Routing-Rules: use sf_format only as an optional value

2009-05-26 Thread halla

Yes, thats exactly the same way like I do it also :-) Except the
sfPropelRoute.
But, like I wrote: This raises a 404 if the URL is called without
suffix :-((

On 26 Mai, 12:19, Gábor Fási maerl...@gmail.com wrote:
 This is how it's done in jobeet, day 15:

 // apps/frontend/config/routing.yml
 category:
   url:     /category/:slug.:sf_format
   class:   sfPropelRoute
   param:   { module: category, action: show, sf_format: html }
   options: { model: JobeetCategory, type: object }
   requirements:
     sf_format: (?:html|atom)

 On Tue, May 26, 2009 at 12:04, halla dha.maili...@googlemail.com wrote:

  Hi everybody,

  I'm using different routes for my application, which also determine
  the response format (xml or json for an REST-based web service).

  This is an example rule in routing.yml:

  user_me:
   url:                  /user/me.:sf_format
   params:               { module: user, action: getUserMe }
   requirements: { sf_method: GET, sf_format: (?:xml|json) }

  Is there a way to set sf_format to XML if NO .xml|json is given in the
  URL (the Suffix should be optional)? So that this ressource can be
  called via the  following URLs:

  (1) /user/me.xml - XML-Response
  (2) /user/me.json - JSON-Response
  (3) /user/me - XML-Response

  Actually, a 404 is raised by symfony if the ressource is called via
  (3).

  Thanks for your help in advance,
  Daniel
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Routing-Rules: use sf_format only as an optional value

2009-05-26 Thread Gábor Fási

No you don't, here's the difference :)

Yours: params:   { module: user, action: getUserMe }
Jobeet: param:   { module: category, action: show, sf_format: html }

On Tue, May 26, 2009 at 12:32, halla dha.maili...@googlemail.com wrote:

 Yes, thats exactly the same way like I do it also :-) Except the
 sfPropelRoute.
 But, like I wrote: This raises a 404 if the URL is called without
 suffix :-((

 On 26 Mai, 12:19, Gábor Fási maerl...@gmail.com wrote:
 This is how it's done in jobeet, day 15:

 // apps/frontend/config/routing.yml
 category:
   url:     /category/:slug.:sf_format
   class:   sfPropelRoute
   param:   { module: category, action: show, sf_format: html }
   options: { model: JobeetCategory, type: object }
   requirements:
     sf_format: (?:html|atom)

 On Tue, May 26, 2009 at 12:04, halla dha.maili...@googlemail.com wrote:

  Hi everybody,

  I'm using different routes for my application, which also determine
  the response format (xml or json for an REST-based web service).

  This is an example rule in routing.yml:

  user_me:
   url:                  /user/me.:sf_format
   params:               { module: user, action: getUserMe }
   requirements: { sf_method: GET, sf_format: (?:xml|json) }

  Is there a way to set sf_format to XML if NO .xml|json is given in the
  URL (the Suffix should be optional)? So that this ressource can be
  called via the  following URLs:

  (1) /user/me.xml - XML-Response
  (2) /user/me.json - JSON-Response
  (3) /user/me - XML-Response

  Actually, a 404 is raised by symfony if the ressource is called via
  (3).

  Thanks for your help in advance,
  Daniel
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Routing-Rules: use sf_format only as an optional value

2009-05-26 Thread halla

 No you don't, here's the difference :)

 Yours: params:               { module: user, action: getUserMe }
 Jobeet: param:   { module: category, action: show, sf_format: html }

Sometimes small things can make a big difference :-)

You're right - now it works great...!!
Thank you very much, Gábor :-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---