Pages

Monday, January 4, 2016

Symfony-Error-Annotation not Imported

[Semantical Error] The annotation "@Template" in method AppBundle\Controller\DefaultController::indexAction() was never imported. Did you maybe forget to add a "use" statement for this annotation? in /var/www/symfony_learn_2_6/src/AppBundle/Controller/ (which is being imported from "/var/www/symfony_learn_2_6/app/config/routing.yml"). 

Recently while working on symfony I encountered above error.The resolution is simple we just need to add Sensio annotation handler for the above annotation.So in this case since annotation handler for template is missing we need to add 

Sensio\Bundle\FrameworkExtraBundle\Configuration\Template

above the controller.Similerly if annotation handler for route is missing then we can add 

Sensio\Bundle\FrameworkExtraBundle\Configuration\Route

1 comment: