无法解析插件“multidb”

时间:2012-03-25 19:20:50

标签: zend-framework zend-db

当我尝试启动我的项目时,我有以下错误消息:

Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'Unable to resolve plugin "multidb"; no corresponding plugin with that name' in C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php:330 

Stack trace:  
#0 C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php(314): Zend_Application_Bootstrap_BootstrapAbstract->getPluginResource('multidb')  
#1 C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php(673): Zend_Application_Bootstrap_BootstrapAbstract->hasPluginResource('multidb')   
#2 C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php(622): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('multidb')   
#3 C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php(579): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap('multidb')   
#4 C:\xampp\htdocs\modular_zf\application\Bootstrap.php(41): Zend_Application_Bootstrap_BootstrapAbstract->bootstrap('multidb')   
#5 C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract in C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php on line 330  

bootstrap.php (第39行)

protected function _initDatabases()
{
    $this->bootstrap('multidb'); // line 41
    $resource = $this->getPluginResource('multidb');
    $databases = Zend_Registry::get('config')->resources->multidb;
    foreach ($databases as $name => $adapter)
    {
        $db_adapter = $resource->getDb($name);
        Zend_Registry::set($name, $db_adapter);
    }
}

application.ini

[bootstrap] 
...   
...   
;Database settings
resources.multidb.front_db.adapter  = "pdo_mysql"
resources.multidb.front_db.host     = 127.0.0.1
resources.multidb.front_db.username = admin
resources.multidb.front_db.password = admin
resources.multidb.front_db.dbname   = modular_zfdb
resources.multidb.front_db.default  = true
...   
...   

我在其他类似的项目中有相同的消息('无法解析插件...)

感谢。

1 个答案:

答案 0 :(得分:2)

更换第41行& 42用这个

$resource = $this->bootstrap('multidb')->getResource('multidb');