Doctrine ODM zf2模块的示例工作配置? [英] example working config for Doctrine ODM zf2 Module?
问题描述
创建此
但仍然是doctrine-module odm:schema:create说所有的集合创建,但在我的数据库中没有集合
<?php
返回数组(
'doctrine'=>数组(
'connection'=>数组(
'odm_default'=>数组(
'server'=>'localhost' ,
'port'=>'27017',
//'user'=> null,
//'password'=> null,
'dbname' =''yehja',
//'options'=> array()
),
),
'configuration'=>数组(
'odm_default'=>数组(
//'metadata_cache'=>'array',
//
// 'driver'=>'odm_default',
//
//'generate_proxies'=> true,
//'proxy_dir'=> 'data',
//'proxy_namespace'=> 'doctrineMongoODMModule\Proxy',
//
//'generate_hydrators'=> true,
//'hydrator_dir'=> 'data',
//'hydrator_namespace'=> 'doctrineMongoODMModule\Hydrator',
//
//'default_db'=> null,
//
//'filters'=> array()// array('filterName'=>'BSON\Filter\Class')
)
// / //),
//'driver'=> ; array(
//'odm_default'=> array(
// //'drivers'=> array('Appl
//)
),
'driver'=> array(
'class'=>'Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver',
'namespace'=>'应用程序\Document',
'paths'=> array('module / Application / src / Application / Document'),
),
'documentmanager'=> array(
'odm_default'=>数组(
//'connection'=>'odm_default',
//'configuration'=>'odm_default',
//'eventmanager '=>'odm_default'
)
),
'eventmanager'=>数组(
'odm_default'=>数组(
'subscribers'= > array()
)
),
),
);```
- > https://github.com/doctrine/DoctrineMongoODMModule
这些作品:
file:config / autoload / module.doctrine-mongo-odm。 local.php
<?php
Doctrine\ ODM\MongoDB\Mapping\Driver\AnnotationDriver :: registerAnnotationClasses();
return array(
'doctrine'=>数组(
'connection'=>数组(
'odm_default'=>数组(
' =>'localhost',
'port'=>'27017',
//'user'=> null,
//'password'=> null,
'dbname'=>'yehja',
//'options'=> array()
),
),
' '=>数组(
'odm_default'=>数组(
//'metadata_cache'=>'array',
//
//'driver'= >'odm_default',
//
//'generate_proxies'=> true,
//'proxy_dir'=>'data',
//'proxy_namespace '="'DoctrineMongoODMModule\Proxy',
//
// 'generate_hydrators'=> true,
//'hydrator_dir'=>'data',
//'hydrator_namespace'=> 'doctrineMongoODMModule\Hydrator',
//
//'default_db'=> null,
//
//'filters'=> array()// array('filterName'=>'BSON\Filter\Class')
)
// / //),
//'driver'=> ; array(
//'odm_default'=> array(
// //'drivers'=> array('Appl
//)
),
'documentmanager'=>数组(
'odm_default'=>数组(
//'连接'=>'odm_default',
//' ='odm_default',
//'eventmanager'=>'odm_default'
)
),
'eventmanager'=>数组(
' odm_default'=>数组(
'subscribers'=> array()
)
),
),
);
和文件:module / Application / config / module.config.php
添加这些行
'doctrine'=> array(
'driver'=> array(
__NAMESPACE__。'_driver'=> array(
'class'=>'Doctrine\ODM\MongoDB\Mapping\\ \\ Driver\AnnotationDriver',
'paths'=>数组(__ DIR__。'/../src/'。__NAMESPACE__。'/ Document')
),
'odm_default'=>数组(
'drivers'=>数组(
__NAMESPACE__。'\Document'=> __NAMESPACE__'_driver'
)
)
)
)
can anyone please provide an example of driver configuration for reading annotation of documents in Application/src/Application/Document/.... created this but still doctrine-module odm:schema:create said all collection created but there is no collection in my db
<?php
return array(
'doctrine' => array(
'connection' => array(
'odm_default' => array(
'server' => 'localhost',
'port' => '27017',
// 'user' => null,
// 'password' => null,
'dbname' => 'yehja',
// 'options' => array()
),
),
'configuration' => array(
'odm_default' => array(
// 'metadata_cache' => 'array',
//
// 'driver' => 'odm_default',
//
// 'generate_proxies' => true,
// 'proxy_dir' => 'data',
// 'proxy_namespace' => 'DoctrineMongoODMModule\Proxy',
//
// 'generate_hydrators' => true,
// 'hydrator_dir' => 'data',
// 'hydrator_namespace' => 'DoctrineMongoODMModule\Hydrator',
//
// 'default_db' => null,
//
// 'filters' => array() // array('filterName' => 'BSON\Filter\Class')
)
// / // ),
// 'driver' => array(
// 'odm_default' => array(
// // 'drivers' => array('Appl
// )
),
'driver' => array(
'class' => 'Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver',
'namespace' => 'Application\Document',
'paths' => array('module/Application/src/Application/Document'),
),
'documentmanager' => array(
'odm_default' => array(
// 'connection' => 'odm_default',
// 'configuration' => 'odm_default',
// 'eventmanager' => 'odm_default'
)
),
'eventmanager' => array(
'odm_default' => array(
'subscribers' => array()
)
),
),
);```
module that im using -> https://github.com/doctrine/DoctrineMongoODMModule
these works :
file : config/ autoload/ module.doctrine-mongo-odm.local.php
<?php
Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver::registerAnnotationClasses();
return array(
'doctrine' => array(
'connection' => array(
'odm_default' => array(
'server' => 'localhost',
'port' => '27017',
// 'user' => null,
// 'password' => null,
'dbname' => 'yehja',
// 'options' => array()
),
),
'configuration' => array(
'odm_default' => array(
// 'metadata_cache' => 'array',
//
// 'driver' => 'odm_default',
//
// 'generate_proxies' => true,
// 'proxy_dir' => 'data',
// 'proxy_namespace' => 'DoctrineMongoODMModule\Proxy',
//
// 'generate_hydrators' => true,
// 'hydrator_dir' => 'data',
// 'hydrator_namespace' => 'DoctrineMongoODMModule\Hydrator',
//
// 'default_db' => null,
//
// 'filters' => array() // array('filterName' => 'BSON\Filter\Class')
)
// / // ),
// 'driver' => array(
// 'odm_default' => array(
// // 'drivers' => array('Appl
// )
),
'documentmanager' => array(
'odm_default' => array(
// 'connection' => 'odm_default',
// 'configuration' => 'odm_default',
// 'eventmanager' => 'odm_default'
)
),
'eventmanager' => array(
'odm_default' => array(
'subscribers' => array()
)
),
),
);
and file : module/ Application/ config/ module.config.php add these lines
'doctrine' => array(
'driver' => array(
__NAMESPACE__ . '_driver' => array(
'class' => 'Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver',
'paths' => array(__DIR__ . '/../src/' . __NAMESPACE__ . '/Document')
),
'odm_default' => array(
'drivers' => array(
__NAMESPACE__ . '\Document' => __NAMESPACE__ . '_driver'
)
)
)
)
这篇关于Doctrine ODM zf2模块的示例工作配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!