1

我的配置错误在哪里?

我尝试在 ZF2 中实现 Doctrine ODM - 看看我的配置文件:

  namespace Application;
  return array(
      'doctrine' => array(

        'connection' => array(
            'odm_default' => array(
                'server'    => 'localhost',
                'port'      => '27017',
                'user'      => null,
                'password'  => null,
                'dbname'    => 'homeup',
                'options'   => array()
            ),
        ),

        'configuration' => array(
            'odm_default' => array(
                'metadata_cache'     => 'array',

                'driver'             => 'odm_default',

                'generate_proxies'   => true,
                'proxy_dir'          => 'data/DoctrineMongoODMModule/Proxy',
                'proxy_namespace'    => 'DoctrineMongoODMModule\Proxy',

                'generate_hydrators' => true,
                'hydrator_dir'       => 'data/DoctrineMongoODMModule/Hydrator',
                'hydrator_namespace' => 'DoctrineMongoODMModule\Hydrator',

                'default_db'         => null,

                'filters'            => array(),  // array('filterName' => 'BSON\Filter\Class'),

                'logger'             => null // 'DoctrineMongoODMModule\Logging\DebugStack'
            )
        ),

        'driver' => array(
            'odm_default' => array(
/*                'drivers' => array(
                    'class'     => 'Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver',
                    'namespace' => 'Application\Document',
                    'paths'     => array('module/Application/src/Application/Document'),
*/
                    'odm_driver' => array(
                        'class' => 'Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver',
                        'paths' => array(__NAMESPACE__ .'/src/' . __NAMESPACE__ . '/Document')
                    ),
                    'odm_default' => array(
                        'drivers' => array(
                            __NAMESPACE__ . '\Document' => 'odm_driver'
                        )
                    )
                )
            )
        ),

        'documentmanager' => array(
            'odm_default' => array(
                'connection'    => 'odm_default',
                'configuration' => 'odm_default',
                'eventmanager' => 'odm_default'
            )
        ),

        'eventmanager' => array(
            'odm_default' => array(
                'subscribers' => array()
            )
        ),
);

信息:

编辑

致命错误:在 C:\xampp\htdocs\homeup.dev\vendor\zendframework 中出现消息“选项“odm_driver”没有必须定义的匹配 setOdmDriver 设置方法”的未捕获异常“Zend\Stdlib\Exception\BadMethodCallException” \zendframework\library\Zend\Servi‌​ceManager\ServiceManager.php 在第 859 行

这比我想象的要容易......解决方案在这里:

Doctrine ODM zf2 模块的示例工作配置?

少即是多。

4

0 回答 0