I wrote this piece of code to my bootstrap
public function _initRouter()
{
$pages = new Pages();
$routes = $pages->getRoutes();
$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();
$router->addRoutes($routes);
return $router;
}
I get the following error message 'No adapter found for Pages'.
I'm using application.ini (Zend_Application) to setup DB connection.
The question is, how can i use database in bootstrap? For use in models etc.
Best Regards,
Philip
You have to make sure that your database is setup before you call the _initRouter function.
Something along the lines of
protected function _initDb()
{
$resource = $this->getPluginResource('db');
$db = $resource->getDbAdapter();
Zend_Db_Table_Abstract::setDefaultAdapter($db);
return $db;
}