gpt4 book ai didi

Symfony2.1 [语义错误] 类 "Annotation"未使用@Annotation 进行注释

转载 作者:行者123 更新时间:2023-12-04 15:56:55 24 4
gpt4 key购买 nike

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

这是当我尝试新的 Composer 更新时(我所有的包/包都已经是最新的)或当我尝试显示网页时的错误消息:

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 文件:

"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注解的使用:

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

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

最佳答案

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

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

但我不明白为什么你的注释不起作用...

关于Symfony2.1 [语义错误] 类 "Annotation"未使用@Annotation 进行注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12843945/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com