Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
882 views
in Technique[技术] by (71.8m points)

php - 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 "SensioBundleFrameworkExtraBundleConfigurationParamConverter" 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 "SensioBundleFrameworkExtraBundleConfigurationParamConverter". If it is indeed no annotation, then you need to add @IgnoreAnnotation("ParamConverter") to the _class_ doc comment of method AcmeBundleMyBundleControllerDefaultController::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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...