Connection DbTable into bootstrap failed
Why this code produces this error?
function _initViewHelpers() { $this->bootstrap('layout'); $layout = $this->getResource('layout'); $view = $layout->getView(); $view->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开发者_StackOverflow中文版($navContainerConfig);
$partial = array('menu/menu.phtml','default');
$view->navigation($navContainer)->setAcl($this->_acl)->setRole(Zend_Registry::get('role'));
$view->navigation()->menu()->setPartial($partial);
}
Error:
Fatal error: Uncaught exception 'Zend_Auth_Adapter_Exception' with message 'No database adapter present' in /volume1/web/LIBRERIE/ZendFrameworkCli/library/Zend/Auth/Adapter/DbTable.php:178 Stack trace: #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/Application.php(355): Zend_Application_Bootstrap_Bootstra in /volume1/web/LIBRERIE/ZendFrameworkCli/library/Zend/Auth/Adapter/DbTable.php on line 178
It seems that you don't bootstrap your database. Try adding:
$this->bootstrap('db');
精彩评论