Module 在模块应用程序中找不到模型类
我是Zend的新手,我在application.ini中定义了一些使用多个db的行Module 在模块应用程序中找不到模型类,module,zend-framework,Module,Zend Framework,我是Zend的新手,我在application.ini中定义了一些使用多个db的行 resources.multidb.sitgm.adapter = "pdo_pgsql" resources.multidb.sitgm.host = "localhost" resources.multidb.sitgm.username = "postgres" resources.multidb.sitgm.password = "pass" resources.multidb.sitgm.dbname
resources.multidb.sitgm.adapter = "pdo_pgsql"
resources.multidb.sitgm.host = "localhost"
resources.multidb.sitgm.username = "postgres"
resources.multidb.sitgm.password = "pass"
resources.multidb.sitgm.dbname = "mydb"
resources.multidb.sitgm.isDefaultTableAdapter = true
在我的应用程序引导中,我有一个功能:
public function _initDbRegistry()
{
$this->_application->bootstrap('multidb');
$multidb = $this->_application->getPluginResource('multidb');
Zend_Registry::set('db_sitgm', $multidb->getDb('sitgm'));
}
但当我迁移到模块squema时,我有一个默认模块,我添加了另一个默认引导
class Default_Bootstrap extends Zend_Application_Module_Bootstrap
{
public function _initDbRegistry()
{
//Do i must add something here to access application DB conf like app bootstrap????
}
}
在这一点上,我如何调用应用程序配置,因为我在默认模型类中遇到了一个找不到的错误
class Default_Model_Base {
protected $db;
public $sql="";
function __construct() {
$this->db = Zend_Registry::get("db_sitgm"); //HERE I GOT THE ERROR
$this->db->setFetchMode(Zend_Db::FETCH_OBJ);
}
}
提前感谢您也不必在模块引导中定义
\u initDbRegistry
。您可以将其保留在应用程序中Bootstrap.php