连接DbTable到引导程序失败

时间:2011-05-01 17:22:51

标签: zend-framework

为什么此代码会产生此错误?

function _initViewHelpers()     {         $这 - >自举( '布局');         $ layout = $ this-> getResource('layout');         $ view = $ layout-> getView();         $视图 - >!DOCTYPE( 'XHTML1_TRANSITIONAL');         $ view-> headMeta() - > appendHttpEquiv('Content-Type','text / html; charset = utf-8');         $ view-> headTitle() - > setSeparator(' - ');         $ view-> headTitle('Rally Slot Club');

    $risultatiTBL = new Application_Model_DbTable_Risultati();
    $risultatiTBL->showMenuRisultati();
    $navContainerConfig = array(
                                array('label' => 'Home Page', 'controller' => 'index', 'action' => 'index', 'resource' => 'index'),
                                array('label' => 'Il Club', 'controller' => '', 'action' => '', 'resource' => ''),
                                array('label' => 'Calendario', 'controller' => 'calendario', 'action' => 'index', 'resource' => 'calendario'),
                                array('label' => 'Risultati', 'controller' => 'risultati', 'action' => 'index', 'resource' => 'risultati'),
                                array('label' => 'Area Riservata', 'class' => 'dir', 'controller' => '', 'action' => '', 'resource' => '', 'pages' => array(
                                                                        array ('label' => 'Gestione Articoli', 'controller' => 'admin', 'action' => 'management-articoli', 'resource' => 'admin'),
                                                                        array('label' => 'Gestione Calendario', 'controller' => 'admin', 'action' => 'management-calendario', 'resource' => 'admin')))
                               );
    $navContainer = new Zend_Navigation($navContainerConfig);
    $partial = array('menu/menu.phtml','default');
    $view->navigation($navContainer)->setAcl($this->_acl)->setRole(Zend_Registry::get('role'));
    $view->navigation()->menu()->setPartial($partial);
}

错误:

致命错误:/colume1/web/LIBRERIE/ZendFrameworkCli/library/Zend/Auth/Adapter/DbTable.php:178未捕获异常'Zend_Auth_Adapter_Exception'并显示消息'无数据库适配器'堆栈跟踪:#0 / volume1 / web / LIBRERIE / ZendFrameworkCli / library / Zend / Auth / Adapter / DbTable.php(140):Zend_Auth_Adapter_DbTable-> _setDbAdapter(NULL)#1 /volume1/web/gsb-slot.it/application/Bootstrap.php(36) :Zend_Auth_Adapter_DbTable-> __ construct(NULL)#2 /volume1/web/LIBRERIE/ZendFrameworkCli/library/Zend/Application/Bootstrap/BootstrapAbstract.php(667):Bootstrap-> _initViewHelpers()#3 / volume1 / web / LIBRERIE /ZendFrameworkCli/library/Zend/Application/Bootstrap/BootstrapAbstract.php(620):Zend_Application_Bootstrap_BootstrapAbstract-> _executeResource('viewhelpers')#4 /volume1/web/LIBRERIE/ZendFrameworkCli/library/Zend/Application/Bootstrap/BootstrapAbstract.php (584):Zend_Application_Bootstrap_BootstrapAbstract-> _bootstrap(NULL)#5 / volume1 / web / LIBRERIE / ZendFrameworkCli / library / Zend / Ap plication.php(355):第178行的/volume1/web/LIBRERIE/ZendFrameworkCli/library/Zend/Auth/Adapter/DbTable.php中的Zend_Application_Bootstrap_Bootstra

1 个答案:

答案 0 :(得分:1)

您似乎没有引导数据库。尝试添加:

$this->bootstrap('db');