我有一个麻烦与我的Sf3应用程序。我有我的应用程序的主包调用storebundle。我创建了另一个包来提供支付,所以在我的SRC目录中有这样的树:
StoreBundle
Controller
CheckoutController.php
Payment
PayUBundle
Controller
PayUController.php
我调用PayUController在CheckoutController使用
use Payment'PayUBundle'Controller'PayUController;
接下来,我创建了一个PayUController类的实例,在本地主机上一切正常,但在服务器上部署后,我有一个异常
Attempted to load class "PayUController" from namespace "Payment'PayUBundle'Controller".
Did you forget a "use" statement for another namespace?
这个错误的原因是什么,我如何修复它?
首先不要使用多个bundle,而是在你的应用中创建不同的控制器接下来检查是否已将所有名称空间放在/root/src/目录下检查这些bundle是否在AppKernel.php中注册了检查AbcdBundle.php文件是否与AppKernel.php中注册的名称空间相同如果可能的话,使用Symfony命令重新生成包:
php app/console generate:bundle --namespace=Payment'PayUBundle
php app/console generate:bundle --namespace=Payment'StoreBundle
最后你描述了你的问题,我认为:
StoreBundle
Controller
和
Payment
PayUBundle
Controller