Boolean Container Parameters in Routes
In Symfony apps, it's possible to use container parameters in the routes config. In Symfony 4.3 we improved this feature to also support boolean parameters, so you can do things like this:
1 2 3 4 5 6 7
/**
* @Route("/test", condition="%kernel.debug%")
*/
class TestController extends AbstractController
{
// ...
}
Deprecated Some Router Options
The following Routing component config options have been deprecated and they will be removed in Symfony 5.0:
generator_base_class
generator_cache_class
matcher_base_class
matcher_cache_class
These classes are no longer used after some recent changes in the Routing code. Besides, using parameters to define the class to use is a practice that Symfony discouraged a few years ago.
Displayed the Route Conditions When Debugging
The debug:router
command helps you debug routing issues by listing all the
available routes and displaying all the details for a given route. In Symfony
4.3 we improved this command to also display the condition of the route (if
defined):
1 2 3 4 5 6 7 8 9 10 11 12 13
$ php bin/console debug:router some_route_name
+--------------+-------------------------------------------------------------------+
| Property | Value |
+--------------+-------------------------------------------------------------------+
| Route Name | |
| Path | /name/add |
| Host | localhost |
| Scheme | http|https |
| Method | PUT|POST |
| ... |
| Condition | context.getMethod() in ['GET', 'HEAD', 'POST'] |
+--------------+-------------------------------------------------------------------+
Really nice improvements! Using boolean container parameter in route config makes life easier :D Thanks!!
Great stuff guys. Thanks
Thanks! This is great.
Nice.