繁体   English   中英

Gymle注释不能与Symfony2项目中的Doctrine2注释解析器一起使用

[英]Guzzle annotations not working with Doctrine2 annotation parser in Symfony2 project

我有一个Symfony2项目,正在尝试集成GuzzleBundle以构建Web服务客户端。 我对客户端命令使用了@guzzle注释(扩展了Guzzle\\Service\\Command\\AbstractCommand )。

它似乎在开发环境中正常工作,但是当我尝试使用生产环境加载页面时,出现了Doctrine AnnotationException

 PHP Fatal error:  Uncaught exception 'Doctrine\Common\Annotations\AnnotationException' with message '[Semantical Error] The annotation "@guzzle" in class Admin\FindAnExpertBundle\Entity\SymplecticClient\Rest\Command\UserById was never imported. Did you maybe forget to add a "use" statement for this annotation?'

我也收到有关缺少的Proxy类文件的错误:

PHP Warning:  require(/home/httpd/sites/experts.admin/app/cache/prod/doctrine/orm/Proxies/AdminFindAnExpertBundleEntityRelationshipTypeProxy.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in /home/httpd/sites/experts.admin/vendor/doctrine/lib/Doctrine/ORM/Proxy/ProxyFactory.php

我认为这是因为致命错误正在阻止所有代理类的创建。

Guzzle似乎没有使用Doctrine注释解析器,所以我想知道是否有办法使其忽略@guzzle注释或以某种方式注册它们?

您必须导入Guzzle的注释解析器,该注释处理“ @guzzle”注释,例如:

use Guzzle\Service\Inspector as guzzle;

但是我不知道那是哪一类。

也许这个要点文件可以为您提供帮助。

最后,我将与Web服务客户端相关的类移出了Entity文件夹,这阻止了Doctrine注释解析器读取它们。 回想起来,这些类都不应该放在该文件夹中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM