[英]mongodb with zf2 gives an error The class was not found in the chain configured namespaces
I know I miss something in the configuration. 我知道我错过了配置中的某些内容。 Can anyone provide the steps for this configuration Mongo is running in my terminal properly. 任何人都可以提供此配置的步骤吗?Mongo在我的终端中正常运行。 when connect with zend in sequential way it works . 当与zend按顺序连接时它起作用。 but in procedural way it gives error. 但以程序方式会产生错误。 this is global config file 这是全局配置文件
'driver' => array(
'odm_default' => array(
'class' => 'Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain',
'drivers' => array()
)
),
when I write 当我写
$dm = $this->getServiceLocator()->get('doctrine.documentmanager.odm_default');
$user = new User();
$user->setName("Gembul");
$dm->persist($user);
persist then it gives class not found error 坚持然后给类找不到错误
When I found this error then I modify my database class means that change the comments in my model class in document section . 当发现此错误时,我将修改数据库类,这意味着更改文档部分中模型类中的注释。
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
/**
* Description of User
*
* @author kiwitech
*/
/** @ODM\Document(collection="user") */
class Users
{
protected $dm;
/** @ODM\Id */
private $_id;
/** @ODM\Field(type="string") */
private $_first_name;
/** @ODM\Field(type="string") */
private $_last_name;
/** @ODM\Field(type="string") */
private $_login_name;
/** @ODM\Field(type="string") */
private $_email;
/** @ODM\Field(type="string") */
private $tp_id;
/** @ODM\Field(type="string") */
private $_is_active;
/** @ODM\Field(type="string") */
private $_role_id;
function get_id() {
return $this->_id;
}
function get_first_name() {
return $this->_first_name;
}
function get_last_name() {
return $this->_last_name;
}
function get_login_name() {
return $this->_login_name;
}
function get_email() {
return $this->_email;
}
function getTp_id() {
return $this->tp_id;
}
function get_is_active() {
return $this->_is_active;
}
function get_role_id() {
return $this->_role_id;
}
function set_id($_id) {
$this->_id = $_id;
}
function set_first_name($_first_name) {
$this->_first_name = $_first_name;
}
function set_last_name($_last_name) {
$this->_last_name = $_last_name;
}
function set_login_name($_login_name) {
$this->_login_name = $_login_name;
}
function set_email($_email) {
$this->_email = $_email;
}
function setTp_id($tp_id) {
$this->tp_id = $tp_id;
}
function set_is_active($_is_active) {
$this->_is_active = $_is_active;
}
function set_role_id($_role_id) {
$this->_role_id = $_role_id;
}
}
then I easily solve this bug :) 然后我轻松解决此错误:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.