Le 12/05/2011 21:43, Donald Tyler a écrit :
Is it currently possible to set a default _format for routes that are
automatically created by importing a controller?
In my current setup, given the following routing.yml:
phone:
resource: Chekote\MyBundle\Controller\PhoneController
type: rest
And the following controller:
class PhoneController extends ContainerAware {
/**
* @extra:Template()
*/
public function getPhoneAction($id) {
return array();
}
}
The RestBundle is generating routes like the following:
get_phone GET /phones/{id}.{_format}
Where the _format parameter is optional, but there's no default value,
so I'm getting the following error:
Fatal error: Uncaught exception 'RuntimeException' with message 'File
name "@ContactBundle/Resources/views/Phone/getPhone..twig" contains
invalid characters (..).'
When navigating to the following URL:
app_dev.php/phone/1
you can add a default value for any parameter the same way than for the
annotations provided by FrameworkExtraBundle as the annotations classes
are provided in the core (only the loader is in the bundle):
/@Route(defaults={"_format"="json", "_locale"="en"})/
--
Christophe | Stof
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
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