我尝试覆盖我的SonataUserBundle GroupAdmin类,如下所示:
namespace Application\Sonata\UserBundle\Admin\Model;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\UserBundle\Admin\Model\GroupAdmin as MyGroupAdmin;
class GroupAdmin extends MyGroupAdmin
{
...
}
在config.yml文件中添加参数:
parameters:
sonata.user.admin.group.class: Application\Sonata\UserBundle\Admin\Model\GroupAdmin
但是当我尝试查看我的表单时,我有一个例外: 尝试加载类" GroupAdmin"来自命名空间" Application \ Sonata \ UserBundle \ Admin \ Model"。 你忘记了"使用"例如声明" Sonata \ UserBundle \ Admin \ Document \ GroupAdmin"," Sonata \ UserBundle \ Admin \ Entity \ GroupAdmin"或" Sonata \ UserBundle \ Admin \ Model \ GroupAdmin"?
我的内核:
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
new AppBundle\AppBundle(),
new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(),
new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
new Sonata\FormatterBundle\SonataFormatterBundle(),
new Sonata\NewsBundle\SonataNewsBundle(),
new Sonata\MediaBundle\SonataMediaBundle(),
new Sonata\IntlBundle\SonataIntlBundle(),
new Sonata\ClassificationBundle\SonataClassificationBundle(),
new FOS\UserBundle\FOSUserBundle(),
new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'),
new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
new JMS\SerializerBundle\JMSSerializerBundle(),
new Application\Sonata\NewsBundle\ApplicationSonataNewsBundle(),
new Application\Sonata\UserBundle\ApplicationSonataUserBundle(),
new Application\Sonata\MediaBundle\ApplicationSonataMediaBundle(),
new Application\Sonata\ClassificationBundle\ApplicationSonataClassificationBundle(),
);
这是6点,我找不到错误。 Plz帮助
答案 0 :(得分:0)
这绝对不是类声明的问题,或者错误会包含'找到了文件,但是课程中没有#39;。
你很可能在文件名中有拼写错误