How to automate function name in symfony routing?
you can look at KNP Rad Bundle:http://rad.knplabs.com/
It does a lot of good things including the one you are talking about
You probably want to create a custom route loader, see.
As far as I know there is currently no out-of-the-box solution to directly map the controllers -> methods -> parameters to a specific route controller/method/param1/param2
like other frameworks do (CodeIgniter, FuelPHP...).
Indeed this can be achieved with custom route loader as @Onema said.
I can think of two other options, none of which do exactly what you wanted but may be of interest:
1. Creating a controller action which would just forward request to other actions2. Using @Route annotation
1.
In AdminController create action:
public function adminAction($actionName){ return $this->forward('MyBundle:TargetController:' . $actionName);}
2.
Annotation routing since it allows you to define routes without naming them. Name will be implicitly created by convention: Annotation routing.
Doesn't do exactly what you wanted but is pretty elegant too if you don't want to make custom route loader:
/** * @Route("/admin/dosmt") */public function dosmtAction(){ return new Response('smtAction');}
Additionally you can mount all controller actions on a prefix just like with YAML routing:
/** * @Route("/admin") */class MyController extends Controller{ /** * @Route("/dosmt") */ public function dosmtAction() { return new Response('smtAction'); }}