Sonata Admin Bundle remove routeCollection roles
I just did it different way, Just overridden isGranted() in entitAdmin.php file. Then you can check permission depending on user roles. But it served our purpose. If we want to use $collection->remove('create'), we can't do that since no way to call the method ("configureRoutes()") in the application run time. Only calling that method ("configureRoutes()") while cache is creating.
/** * {@inheritdoc} */public function isGranted($name, $object = null){ $user = $this->getConfigurationPool()->getContainer()->get('security.context')->getToken()->getUser(); switch ($name) { case "CREATE": if (!$user->hasRole("ROLE_ADMIN")) { return false; } default: return true; }}