Let's say I have this code in a controller:
<?php
namespace Foo\BarBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration as Mvc;
/**
* @Mvc\Route("/foo/bar")
*/
class TestController extends Controller
/**
* @Mvc\Route("/test/{id}", requirements={"id" = "[0-9]{1,6}"})
* @Mvc\Template
*
* @return view
*/
public function testAction($id)
{
return array('test' => $id);
}
}
How can I link to this route in a twig template? Usually I can just call
{{ path('route_name', {'paramkey': 'paramvalue'}) }}
But here I have no name to call. Same thing, how would I call it in a controller (for a redirect)?
Thanks.