我有一个Symfony2项目,正在尝试集成GuzzleBundle来构建一个web服务客户端。我正在为客户端命令使用@guzzle
注释(它扩展了Guzzle'Service'Command'AbstractCommand
)。
它似乎在开发环境中正常工作,但当我尝试使用prod环境加载页面时,我会得到一个条令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注释解析器读取它们。回想起来,这些类无论如何都不应该在那个文件夹中。