我在我的项目供应商中有捆绑。必要的覆盖 EditController 类。我的供应商捆绑包在 CedricLambardot AdminGeneratorBundle 的帮助下构建。我覆盖 *-generator.yml 并指出 params.bundle_name 名称我的供应商包。Owerrite 控制器也是,但他不工作,所有使用供应商控制器的相同 symfony。
来自供应商的 EditController.php:
namespace Acme\ProductBundle\Controller\Product;
use Admingenerated\AcmeProductBundle\BaseProductController\EditController as BaseEditController;
// ...
class EditController extends BaseEditController
{
// ...
}
覆盖 EditController.php
namespace Acme\AnniProductBundle\Controller\Product;
use Acme\ProductBundle\Controller\Product\EditController as BaseEditController;
// ...
class EditController extends BaseEditController
{
// ...
}
我覆盖的 *-generator.yml:
generator: admingenerator.generator.doctrine_odm
params:
model: Acme\AnniProductBundle\Document\Product
namespace_prefix: Acme
bundle_name: ProductBundle
object_actions:
delete: ~
fields:
name:
label: Name
# ...
# ...
我的路线:
Acme_ProductBundle_Product_list:
path: /product/
defaults: { _controller: AcmeAnniProductBundle:Product\List:index }
Acme_ProductBundle_Product_filters:
path: /product/filter
defaults: { _controller: AcmeAnniProductBundle:Product\List:filter }
Acme_ProductBundle_Product_edit:
path: /product/{pk}/edit
defaults: { _controller: AcmeAnniProductBundle:Product\Edit:index }
Acme_ProductBundle_Product_update:
path: /product/{pk}/update
defaults: { _controller: AcmeAnniProductBundle:Product\Edit:update }
Acme_ProductBundle_Product_object:
path: /product/{pk}/{action}
defaults: { _controller: AcmeAnniProductBundle:Product\Actions:object }
Acme_ProductBundle_Product_new:
path: /product/new
defaults: { _controller: AcmeAnniProductBundle:Product\New:index }
Acme_ProductBundle_Product_create:
path: /product/create
defaults: { _controller: AcmeAnniProductBundle:Product\New:create }
我究竟做错了什么?