symfony2 – Routing – Multiple Routes

In Symfony it’s possible to define multiple routes for one action. This can be very helpful if you have functions that do the same but have different parameters.

class TestController extends Controller
     * @Route("/test1/{id}", name="test")
     * @Route("/test2/{id}", name="test2")
     * Here you can define multiple routes with multiple names
    public function testAction(Test $test)
        if (!$test) {
            throw $this->createNotFoundException('Test record not found.');

        return $this->render('::Test/test.html.twig', array('test' => $test));

if you want to reproduce, please indicate the source:
symfony2 – Routing – Multiple Routes - CodeDay