2012-07-17 28 views
0

我有一個Symfony2項目,並且正在嘗試集成GuzzleBundle來構建Web服務客戶端。我將@guzzle註釋用於客戶端命令(其擴展爲Guzzle\Service\Command\AbstractCommand)。在Symfony2項目中不能與Doctrine2註解解析器一起使用的Guzzle註解

它似乎在開發環境中正常工作,但是當我嘗試使用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註釋或以某種方式註冊它們?

回答

0

我最終將有關Web服務客戶端的類移出Entity文件夾,該文件夾阻止了Doctrine註釋解析器讀取它們。回想起來,這些課程不應該放在那個文件夾中。

0

你不得不進口狂飲的註解解析器,它處理「@guzzle」的註釋,例如:

use Guzzle\Service\Inspector as guzzle; 

但我不知道它是哪一個類。

也許this gist file可以幫助你。

+0

感謝您的指針。我試圖找到負責guzzle註釋的類,但沒有任何運氣。事後看來,我認爲與Web服務客戶端相關的類應該不在實體文件夾中。 – StuBez 2012-07-30 11:45:14