Zend framework2 致命错误:zfc rbac快速启动中出现未捕获异常

Zend framework2 致命错误:zfc rbac快速启动中出现未捕获异常,zend-framework2,Zend Framework2,我试图学习zfc rbac教程。我马上就被卡住了。我想我需要创建一个服务,但是教程没有关于如何创建服务的提示 谢谢你的帮助 module.config.php --------------- 'service_manager' => array( 'factories' => array( 'Zend\Authentication\AuthenticationService' => function($sm) { // Creat

我试图学习zfc rbac教程。我马上就被卡住了。我想我需要创建一个服务,但是教程没有关于如何创建服务的提示

谢谢你的帮助

module.config.php
---------------
'service_manager' => array(
    'factories' => array(
        'Zend\Authentication\AuthenticationService' => function($sm) {
            // Create your authentication service!
        }
    ),

),
'zfc_rbac' => [
    'protection_policy' => \ZfcRbac\Guard\GuardInterface::POLICY_ALLOW,
    'guards' => [
        'ZfcRbac\Guard\RouteGuard' => [
            //ADMIN ACCOUNT GUARDS
            'user' => ['admin-master'],
            'user/login' => ['guest'],
            'user/logout' => ['admin-master', 'merchant-worker', 'guest'],
            'user/register' => ['admin-master', 'merchant-admin', 'guest'],
            'user/change-password' => ['admin-master', 'merchant-worker'],
            'user/forgot-password' => ['guest'],
            //CUSTOMER ACCOUNT GUARDS
            'customer' => ['customer'],
        ]
    ],
    'identity_provider' => \RoleBasedUser\Service\AuthenticationService::class,
    'role_provider' => [
        'ZfcRbac\Role\ObjectRepositoryRoleProvider' => [
            'object_manager' => 'doctrine.entitymanager.orm_default',
            'class_name' => 'RoleBasedUser\Entity\HierarchicalRole',
            'role_name_property' => 'name'
        ]
    ],
    'redirect_strategy' => [
        'redirect_when_connected' => true,
        'redirect_to_route_connected' => 'home',
        'redirect_to_route_disconnected' => 'user/login',
        'append_previous_uri' => true,
        'previous_uri_query_key' => 'redirectTo'
    ],
]

在我的控制器中,我有以下内容

AlbumController.php
-----------------
public function indexAction() {
    if (!$this->authorizationService->isGranted('delete')) {
        throw new UnauthorizedException();
    }
    return new ViewModel(array(
        'myfetch' => $this->getAlbumTable()->fetchAll(),
            )
    );
}
我收到的错误消息是:

致命错误:未捕获异常 带有消息的“Zend\ServiceManager\Exception\ServiceNotFoundException” 'Zend\ServiceManager\ServiceManager::get无法获取或创建 中RoleBasedUser\Service\AuthenticationService'的实例 C:\Users\Sama\Documents\NetBeansProjects\zf2\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php:550

尝试安装module.config.php并向其添加别名,如中所述

AlbumController.php
-----------------
public function indexAction() {
    if (!$this->authorizationService->isGranted('delete')) {
        throw new UnauthorizedException();
    }
    return new ViewModel(array(
        'myfetch' => $this->getAlbumTable()->fetchAll(),
            )
    );
}
'service_manager' => array(
    'aliases' => array(
        'Zend\Authentication\AuthenticationService' =>'zfcuser_auth_service'  
    )  
 )