symfony2 Basic routing Annotation-based routing


By default, all the controllers you generate with Symfony's built-in generate:controller command will make use of Symfony annotations for routing:

namespace AppBundle\Controller;

// You have to add a use statement for the annotation
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

class AcmeController
     * @Route("/index")
    public function indexAction()
        // ...

In order for the framework to handle these routes, you need to import them in your routing.yml as follows (notice the annotation type):

    resource: "@AppBundle/Controller"
    type:     annotation