Is there a recommended way of choosing how to give data to a controller?
Often I have to decide if I want to use route place holders like:
/**
* @Route("/hello/{name}", name="hello")
*/
public function indexAction($name)
{
return new Response('<html><body>Hello '.$name.'!</body></html>');
}
Usage: /hallo/Thorsten
Or use query parameters ($_GET):
/**
* @Route("/hello")
*/
public function indexAction()
{
$request = Request::createFromGlobals();
$name = $request->get('name');
return new Response('<html><body>Hello '.$name.'!</body></html>');
}
Usage: /hallo?name=Thorsten