/**
*@Route ("/hello/{name}", name="_demo_hello")
*
**/
I saw this method in this youtube tutorial Go to 7:36 I wanted to know what is the significance of the "name" method? Can you make up the name method?
Thank you in advance.
/**
*@Route ("/hello/{name}", name="_demo_hello")
*
**/
I saw this method in this youtube tutorial Go to 7:36 I wanted to know what is the significance of the "name" method? Can you make up the name method?
Thank you in advance.
The
name
option when defining routes with annotations is useful if you want to customize the name of the route. By default, if there is noname
specified, Symfony will generate a name based on the controller's action name, like this:indexAction in the WebController of the AppBundle => app_web_index
But you can use the name option to change that:
@Route ("/", name="homepage")
You can then use this name to refer to this route in your controllers or templates:
{{ path('homepage') }}