1

我使用 Zend Framework 2 开始了一个项目,并设置了模块 ZfcUser 和 BjyAuthorize。ZfcUser 部分工作正常,但是当我激活 BjyAuthorize 时发生错误

Doctrine\ORM\EntityNotFoundException:找不到实体。在 /vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php 第 177 行调用堆栈

这是我的配置文件: - comper.json

{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
    "framework",
    "zf2"
],
"homepage": "http://framework.zend.com/",
"require": {
    "php": ">=5.3.3",
    "zendframework/zendframework": "2.3.*",
    "zf-commons/zfc-user": "dev-master",
    "zendframework/zftool": "dev-master",
    "doctrine/doctrine-orm-module": "0.8.0",
    "gedmo/doctrine-extensions": "v2.3.9",
    "zendframework/zend-developer-tools": "dev-master",
    "zf-commons/zfc-user-doctrine-orm": "dev-master",
    "zf-commons/zfc-admin": "dev-master",
    "bjyoungblood/bjy-authorize": "1.4.0"
}
}

应用程序.config.php

return array(
'modules' => array(
    'ZendDeveloperTools',
    'ZfcAdmin',
    'DoctrineModule',
    'DoctrineORMModule',
    'ZfcBase',
    'ZfcUser',
    'ZfcUserDoctrineORM',
    'BjyAuthorize',
    'Application',
    'Fountain',
    'Rest',
),
'module_listener_options' => array(
    'module_paths' => array(
        './module',
        './vendor',
    ),
    'config_glob_paths' => array(
        'config/autoload/{,*.}{global,local}.php',
    ),
),
);

bjyauthorize.global.php

  return array(
 'bjyauthorize' => array(
    'default_role' => 'guest',
    'identity_provider' => 'BjyAuthorize\Provider\Identity\ZfcUserZendDb',
    'role_providers' => array(
        'BjyAuthorize\Provider\Role\Config' => array(
            'guest' => array(),
            'user'  => array('children' => array(
                'admin' => array(),
            )),
        ),
        'BjyAuthorize\Provider\Role\ZendDb' => array(
            'table'                 => 'role',
            'identifier_field_name' => 'id',
            'role_id_field'         => 'roleId',
            'parent_role_field'     => 'parent_id',
        ),
        'BjyAuthorize\Provider\Role\ObjectRepositoryProvider' => array(
            'role_entity_class' => 'Fountain\Entity\Role',
            'object_manager'    => 'doctrine.entitymanager.orm_default',
        ),
    ),

    'resource_providers' => array(
        'BjyAuthorize\Provider\Resource\Config' => array(
            'pants' => array(),
        ),
    ),
    'rule_providers' => array(
        'BjyAuthorize\Provider\Rule\Config' => array(
            'allow' => array(
                array(array('guest', 'user'), 'pants', 'wear')
            ),
            'deny' => array(
                // ...
            ),
        ),
    ),
    'guards' => array(
        'BjyAuthorize\Guard\Controller' => array(
            array('controller' => 'index', 'action' => 'index', 'roles' => array('guest','user')),
            array('controller' => 'index', 'action' => 'stuff', 'roles' => array('user')),
            array(
                'controller' => array('index', 'static', 'console'),
                'action' => array('list', 'manage'),
                'roles' => array('guest', 'admin')
            ),
            array(
                'controller' => array('search', 'administration'),
                'roles' => array('staffer', 'admin')
            ),
            array('controller' => 'zfcuser', 'roles' => array()),
        ),
        'BjyAuthorize\Guard\Route' => array(
            array('route' => 'zfcuser', 'roles' => array('user')),
            array('route' => 'zfcuser/logout', 'roles' => array('user')),
            array('route' => 'zfcuser/login', 'roles' => array('guest')),
            array('route' => 'zfcuser/register', 'roles' => array('guest')),
            // Below is the default index action used by the ZendSkeletonApplication
            array('route' => 'home', 'roles' => array('guest', 'user')),
            array('route' => 'home', 'roles' => array('guest', 'user', 'admin')),

            array('route' => 'fountain', 'roles' => array('guest', 'user')),
            array('route' => 'fountain/add', 'roles' => array( 'admin')),
            array('route' => 'fountain/delete', 'roles' => array('admin')),
            array('route' => 'fountain/edit', 'roles' => array('admin')),
        ),
    ),
),
);

zfcuserdoctrineorm.global.php

return array(
'doctrine' => array(
    'driver' => array(
        // overriding zfc-user-doctrine-orm's config
        'zfcuser_entity' => array(
            'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
            'paths' => array( __DIR__ .'/../../module/Fountain/src/Fountain/Entity'),
        ),

        'orm_default' => array(
            'drivers' => array(
                'Fountain\Entity' => 'zfcuser_entity',
            ),
        ),
    ),
),

'zfcuser' => array(
    // telling ZfcUser to use our own class
    'user_entity_class'       => 'Fountain\Entity\User',
    'enable_default_entities' => false,
),
);

有人知道这个问题的根源吗?

4

0 回答 0