Reputation: 201
I'am newbie starting working with Symfony.
Atm im doing quick tour from official symfony documentation... but im stuck with controller!
I'm sure i did same thing as in toutorial yet error occured: "No route found for "GET /hello/name"
Here's my code:
\src\AppBundle\Controller\DefaultController.php
/**
* @Route("hello/name{name}", name="hello")
*/
public function helloAction($name)
{
return $this->render('default/hello.html.twig', array(
'name'=> $name
));
}
\app\Resources\views\default\hello.html.twig
{%extends 'base.html.twig' %}{% block body %}
<h1>Hi {{name}}! Welcome to Symfony!</h1>{%endblock%}
Upvotes: 2
Views: 53
Reputation: 19610
The tutorial shows:
/**
* @Route("hello/{name}", name="hello")
*/
and it works, since the static route part is hello
followed by a parameter.
You have @Route("hello/name{name}", name="hello")
It is not very clear what do you want exactly, if you want to have /hello/name/xxx
, you should try @Route("hello/name/{name}", name="hello")
Upvotes: 3