I am trying to store custom routes for the Zend Framework inside the database. I have the process down that will create the route, but the problem I am running into is that when I am adding the routes it looks like Zend has not yet created its connection to the database.
Does anyone know where this processes initially happens or how I can force the database to connect from the init_routes function inside Bootstrap.php?
Thanks
Josh Pennington
UPDATE:
What I am doing from Bootstrap.php is calling a model that will return all the Zend_Controller_Router_Route_Static objects for the vendors. Here is the code I am using inside Bootstrap.php
$frontController = Zend_Controller_Front::getInstance();
$router = $frontController->getRouter();
$vendor_routes = new Application_Model_Vendor();
$vendor_routes = $vendor_routes->getStaticRoutes();
The code inside the getStaticRoutes() function is as follows:
public function getStaticRoutes() {
$select = $this->select();
$select->from($this)
->where("featured = 1");
$rows = $this->fetchAll($select);
foreach($rows as $row) {
print_r($row);
}
}
This function is contained in a model that extends Zend_Db_Table_Abstract
The error that I am getting is as follows:
<b>Fatal error</b>: Uncaught exception 'Zend_Db_Table_Exception' with message 'No adapter found for Application_Model_Vendor' in /var/www/vhosts/weddingdir/weddingdir/library/Zend/Db/Table/Abstract.php:754
Stack trace:
#0 /var/www/vhosts/weddingdir/weddingdir/library/Zend/Db/Table/Abstract.php(739): Zend_Db_Table_Abstract->_setupDatabaseAdapter()
#1 /var/www/vhosts/weddingdir/weddingdir/library/Zend/Db/Table/Abstract.php(268): Zend_Db_Table_Abstract->_setup()
#2 /var/www/vhosts/weddingdir/weddingdir/application/Bootstrap.php(17): Zend_Db_Table_Abstract->__construct()
#3 /var/www/vhosts/weddingdir/weddingdir/library/Zend/Application/Bootstrap/BootstrapAbstract.php(666): Bootstrap->_initRoutes()
#4 /var/www/vhosts/weddingdir/weddingdir/library/Zend/Application/Bootstrap/BootstrapAbstract.php(619): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('routes')
#5 /var/www/vhosts/weddingdir/weddingdir/library/Zend/Application/Bootstrap/BootstrapAbstract.php(583): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NUL in <b>/var/www/vhosts/weddingdir/weddingdir/library/Zend/Db/Table/Abstract.php</b> on line <b>754</b><br />
Thanks again!