I work with SonataAdminBundle and SonataUserBundle.
SonataUserBundle registers the sonata.user.admin.group service, which is automatically detected by SonataAdminBundle, to establish links in the admin control panel for grouping CRUD operations.
How to disable sonata.user.admin.group ? I follow these recipes in the Symfony2 documentation:
So far, I have the following code in my package definition to add a compiler pass:
public function build(ContainerBuilder $container) { parent::build($container); $container->addCompilerPass(new CompilerPass()); }
And here is the compiler pass:
<?php namespace NS\Service\CompilerPass; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; class CompilerPass implements CompilerPassInterface { public function process(ContainerBuilder $container) { $container->removeDefinition('sonata.user.admin.group'); } }
I thought this should work, but no. Symfony throws an exception telling me that the sonata.user.admin.group service sonata.user.admin.group not exist. But it exists, and if I do $container->getDefinition('sonata.user.admin.group') , the actual definition is the return.
thanks
source share