Chris Sedlmayr
Chris Sedlmayr

Reputation: 979

Symfony2 ParamConverter not associated with @Annotation (cache must be cleared after any file change)

I have a Controller that uses Annotations for Route, Method, Template and ParamConverter.
If I make any change to the file (even a whitespace change or comment) on the next page load the following error occurs

Cannot import resource "/home/sites/MySite/src/Acme/Bundle/MyBundle/Controller/" from "/home/sites/MySite/app/config/routing.yml".

FileLoaderLoadException: Cannot import resource "/home/sites/MySite/src/Acme/Bundle/MyBundle/Controller/" from "/home/sites/MySite/app/config/routing.yml"

AnnotationException: [Semantical Error] The class "Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter" is not annotated with @Annotation. Are you sure this class can be used as annotation? If so, then you need to add @Annotation to the _class_ doc comment of "Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter". If it is indeed no annotation, then you need to add @IgnoreAnnotation("ParamConverter") to the _class_ doc comment of method Acme\Bundle\MyBundle\Controller\DefaultController::viewAction().

If I clear my cache, then it will work again, but only until I make another change, then it happens again. It looks like it's hitting an issue when reading in the annotation info for config, but I can't understand why it works/doesn't work when the change isn't actually made to any annotation.

Upvotes: 2

Views: 2179

Answers (1)

Chris Sedlmayr
Chris Sedlmayr

Reputation: 979

Ah, it's a known bug, fixed in the FrameworkExtraBundle.

https://github.com/symfony/symfony/issues/7283

And for now to get the latest, just change the requirement for that library to dev-master

"require": {
    ...
    "symfony/symfony": "2.2.*",
    "sensio/framework-extra-bundle": "dev-master",
   ...
},

and run composer update

Upvotes: 8

Related Questions