Routing is the main part to any application. Tomahawk makes use of Symfony's poweful Routing Component, as there's no point re-inventing the wheel. You can read more about Symfony Routing here.
You add routes in the
You define routes using the
There should be one instantiated in this file already.
From the example above, the 1st parameter is the path, the 2nd is the name of the route (used by the URL Generator) and the 3rd is the callback.
A callback can be either a closure or string defining the class and method in the following formats
Short Bundle Notation
UserBundle:User:home which would get converted
Controllerin your bundle. The Controller name also needs to end with Controller e.g
The action name in the Controller class should also end with action. e.g.
You can define parameters to capture in the URL.
You can also set a default value:
Declaring parameter constraints:
You can also have the Request passed in to the callback:
You can also define a section to control a group of routes.
You can also pass in a set of default parameters to be used by the request, useful for defining routes that require auth for example.