Closed shishi666 closed 9 years ago
Ping @bakura10 for transalation :P
Shishi, penses à écrire en anglais stp, je suis le seul à être français ici ^^. Pense également à ajouter le coloriage pour ton code, c'est impossible à lire (https://help.github.com/articles/github-flavored-markdown/#syntax-highlighting).
Haha yup @danizord, I'll try to help him ;).
I have edited my question
Hi,
I think the error come from this:
class RoleProviderFactory implements FactoryInterface
{
/* (non-PHPdoc)
* @see \Zend\ServiceManager\FactoryInterface::createService()
*/
public function createService(\Zend\ServiceManager\ServiceLocatorInterface $serviceLocator)
{
// TODO Auto-generated method stub
$sm = $serviceLocator->get('ServiceManager');
$roleRepository = $sm->get('shishi-user-role-repository');
$roleDbProvider = new RoleDbProvider();
$roleDbProvider->setRoleRepository($roleRepository);
return $roleDbProvider;
}
}
This object is constructed using a plugin manager (the role provider plugin manager).
The $serviceLocator you received in the factory is a plugin manager. If you want to retrieve the main service locator, you have to replace:
$sm = $serviceLocator->get('ServiceManager');
to:
$sm = $serviceLocator->getServiceLocator();
getServiceLocator is a method defined on each plugin manager that allows to retrieve the amin plugin manager.
Let me know if that works!
Et merci d'avoir traduit en anglais ;).
Hi, I get the same error when i replace this code :
$sm = $serviceLocator->get('ServiceManager');
by
$sm = $serviceLocator->getServiceLocator();
the error :
Fatal error: Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'ZfcRbac\Role\RoleProviderPluginManager::get was unable to fetch or create an instance for role-db-provider' in E:\Zend studio 12 Workspace\ShishiBlog\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php:555 Stack trace: #0 E:\Zend studio 12 Workspace\ShishiBlog\vendor\zendframework\zendframework\library\Zend\ServiceManager\AbstractPluginManager.php(116): Zend\ServiceManager\ServiceManager->get('role-db-provide...', true) #1 E:\Zend studio 12 Workspace\ShishiBlog\vendor\zf-commons\zfc-rbac\src\ZfcRbac\Factory\RoleServiceFactory.php(56): Zend\ServiceManager\AbstractPluginManager->get('role-db-provide...', Array) #2 [internal function]: ZfcRbac\Factory\RoleServiceFactory->createService(Object(Zend\ServiceManager\ServiceManager), 'zfcrbacservicer...', 'ZfcRbac\\Service...') #3 E:\Zend studio 12 Workspace\ShishiBlog\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php( in E:\Zend studio 12 Workspace\ShishiBlog\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php on line 555
If you want another code by example my module.config.php code, i can give it you
thanks a lot for your help
Ha maybe I get it. In your "role_provider" key you called it "role-db-provider", but in your plugin manager config you called it "role_db_provider". Those are different names!
I'll assume that the problem was the incorrect config key. Closing due to lack of activity.
Hello I have perhaps not understood the doc but I have declared this in my zfc_rbac.global.php file :
My factory :
And the RoleProviderClass :
and i obtain this error :
Fatal error: Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'ZfcRbac\Role\RoleProviderPluginManager::get was unable to fetch or create an instance for role-db-provider'
I try to retrieve roles from my database, could you explain me what I am doing wrong please? Thank you in advance cordially