首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Symfony2.1 [Semantical Error]类"Annotation“未使用@Annotation进行注释

Symfony2.1 [Semantical Error]类"Annotation“未使用@Annotation进行注释
EN

Stack Overflow用户
提问于 2012-10-12 00:09:30
回答 1查看 2.3K关注 0票数 3

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

当我尝试新的composer更新时(我所有的包/包都已经是最新的),或者当我尝试显示网页时,会出现以下错误消息:

代码语言:javascript
复制
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了。composer.json文件:

代码语言:javascript
复制
"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注释的使用:

代码语言:javascript
复制
   /**
     * @ParamConverter("someEntity", class="VendorSomeBundle:SomeEntity", options={"entity_manager" = "someentitymanagername"})
     */

我从Symfony 2.1复制/粘贴了web/app.php,app/autoload.php文件。

EN

回答 1

Stack Overflow用户

发布于 2012-10-12 16:01:34

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

代码语言:javascript
复制
   /**
    * @Route("/id/randomroute", name="random_route")
    */
    public function highconnexionAction(Entity $entity)

但我不明白为什么你的注解不起作用。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12843945

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档