Symfony2.1 [语义错误]类“注释”没有用@Annotation注释 [英] Symfony2.1 [Semantical Error] The class "Annotation" is not annotated with @Annotation

查看:513
本文介绍了Symfony2.1 [语义错误]类“注释”没有用@Annotation注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将Symfony 2.0应用程序升级到2.1,但我被阻止...:(

I try to upgrade a Symfony 2.0 application to 2.1, but i'm blocked ... :(

这里我尝试新的作曲家更新时出现错误消息(我的所有包/捆绑包都已经是最新的),或者当我尝试显示一个网页时:

Here the error message when i try a new composer update (all my package/bundle are already up-to-date), or when i try to display a web page :

Loading composer repositories with package information
Updating dependencies                                     
Generating autoload files

  [Doctrine\Common\Annotations\AnnotationException]                                                                                                                                                                                                                                                                                                                                                              
  [Semantical Error] The class "Annotation" 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 "Annotation". If it is indeed no annotation, then you need to add @IgnoreAnnotation("Annotation") to the _class_ doc comment of class @Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter.  

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception

  [RuntimeException]                                                         
  An error occurred when executing the "'cache:clear --no-warmup'" command.

我们已经在Symfon2.0应用程序中使用作曲家了。
composer.json文件:

We already use composer for Symfon2.0 app. The composer.json file :

"symfony/symfony":               "2.1.*@stable",
"doctrine/orm":                  "2.3.*@stable",
"doctrine/doctrine-bundle":      "1.0.*@stable",
"twig/extensions":               "1.0.*",
"symfony/assetic-bundle":        "2.1.*@stable",
"symfony/swiftmailer-bundle":    "2.1.*@stable",
"symfony/monolog-bundle":        "2.1.*@stable",
"sensio/distribution-bundle":    "2.1.*@stable",
"sensio/framework-extra-bundle": "2.1.*@stable",
"sensio/generator-bundle":       "2.1.*@stable",
"jms/security-extra-bundle":     "1.2.*@stable",
"jms/di-extra-bundle":           "1.1.*@stable",

"craue/twigextensions-bundle":       "dev-master",
"friendsofsymfony/rest-bundle":      "0.9.*@stable",
"friendsofsymfony/user-bundle":      "1.3.*@stable",
"genemu/form-bundle":                "2.1.x-dev",
"google/api-client":                 "0.5.0",
"knplabs/knp-menu-bundle":           "1.1.*@stable",
"knplabs/knp-paginator-bundle":      "2.2",
"leafo/lessphp":                     "0.3.*@stable",
"mopa/bootstrap-bundle":             "2.1.*",
"natxet/CssMin":                     "dev-master",
"stof/doctrine-extensions-bundle":   "1.1.x-dev",
"twitter/bootstrap":                 "2.0.4",

的ParamConverter注释:

The use of ParamConverter annotation :

   /**
     * @ParamConverter("someEntity", class="VendorSomeBundle:SomeEntity", options={"entity_manager" = "someentitymanagername"})
     */

我复制/粘贴来自Symfony 2.1的web / app.php,app / autoload.php文件。

I copied/paste the web/app.php, app/autoload.php files from Symfony 2.1.

推荐答案

使用Symfony2.1,你不需要ParamConverter注释了。以下示例将触发查询,并提供您需要的实体。

With Symfony2.1, you don't need a ParamConverter annotation anymore. The following example will trigger a query and give you the entity you need.

   /**
    * @Route("/id/randomroute", name="random_route")
    */
    public function highconnexionAction(Entity $entity)

但是我看不到你的注释为什么不起作用...

But I can't see why your annotation doesn't work...

这篇关于Symfony2.1 [语义错误]类“注释”没有用@Annotation注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆