我的配置错误在哪里?
我尝试在 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()
)
),
);
信息:
- 使用教程:https ://github.com/doctrine/DoctrineMongoODMModule
- ZF2 版本 2.2.4
- 教义开发大师
- MongoDB PHP 驱动程序工作(使用纯 PHP)
- 浪费时间和搜索网络
编辑
致命错误:在 C:\xampp\htdocs\homeup.dev\vendor\zendframework 中出现消息“选项“odm_driver”没有必须定义的匹配 setOdmDriver 设置方法”的未捕获异常“Zend\Stdlib\Exception\BadMethodCallException” \zendframework\library\Zend\ServiceManager\ServiceManager.php 在第 859 行
这比我想象的要容易......解决方案在这里:
少即是多。