我的Sf3应用程序出了问题。我有我的应用程序的主要捆绑,调用StoreBunlde。我创建了另一个用于提供付款的捆绑包,所以我的SRC目录中有这样的树:
StoreBundle
Controller
CheckoutController.php
Payment
PayUBundle
Controller
PayUController.php
我使用CheckoutController调用PayUController
use Payment\PayUBundle\Controller\PayUController;
接下来我创建了一个PayUController类的实例,并且在localhost上一切正常但在服务器上部署后我得到了一个例外
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
在不同的命名空间