How to extends Sonata\\DoctrineORMAdminBundle\\Model\\ModelManager

喜你入骨 提交于 2019-12-06 01:58:48

You have a very big problem here:

class ModelManager extends ModelManager

You try to extend class from self. It's wrong! You need to declare your base class with Fully Qualified Name or use use statement. Also you forgot to put namespace declaration. Something like this will work:

namespace Acme\Bundle\DemoBundle\Model;

use Sonata\DoctrineORMAdminBundle\Model\ModelManager as BaseClass;

class ModelManager extends BaseClass

You forgot the namespace

namespace Acme\MyDoctrineORMAdminBundle\Model\ModelManager;

You need to use bundle inheritance.

// src/Acme/MyDoctrineORMAdminBundle/MyDoctrineORMAdminBundle.php

namespace Acme\MyDoctrineORMAdminBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class MyDoctrineORMAdminBundle extends Bundle
{
    public function getParent()
    {
        return 'DoctrineORMAdminBundle';
    }
}
webDEVILopers

You have to modify the service that is going to be injected, see:

Admin's documentation - Reference - Advanced (master) - 26.1. Service Configuration

# app/config/config.yml
admins:
sonata_admin:
    sonata.order.admin.order:   # id of the admin service this setting is for
        model_manager:          # dependency name, from the table above
            sonata.order.admin.order.manager  # customised service id

For an individual Model Manager on an Admin Class please see this answer: SonataDoctrineORM - Model extends

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!