1

I have the following in my application.ini file

resources.db.adapter = "PDO_MYSQL" resources.db.params.host = "localhost" resources.db.params.username = ".." resources.db.params.password = ".." resources.db.params.dbname = "lsc3_base" resources.db.isDefaultTableAdapter = true

Now this works perfectly and I can query the database no problem.

Im trying to install ZFDebug which also was easy using the following in my main bootstrap.php file

` protected function _initZFDebug() { $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace('ZFDebug');

    $options = array(
        'plugins' => array('Variables', 
            'Time',
            #'Auth',
            'Memory',
            'Registry', 
            'Database' => array('adapter' => $db), 
            'File' => array('basePath' => '/path/to/project'),
            #'Cache' => array('backend' => $cache->getBackend()), 
            'Exception')
    );
    $debug = new ZFDebug_Controller_Plugin_Debug($options);

    $this->bootstrap('frontController');
    $frontController = $this->getResource('frontController');
    $frontController->registerPlugin($debug);
} 

` Now this obviously gives me a notice saying $db undefined.

Question is how do I get hold of $db?

I have tried the following: $db = Zend_Db_Table::getDefaultAdapter(); $db = $this->getPluginResource('db');

Which I am assuming dont work because its connecting to the database AFTER doing all of the things in my bootstrap. How can I resolve this?

1 Answer 1

3

This should help, make a $db variable like this:

$this->bootstrap('db');
$db = $this->getPluginResource('db')->getDbAdapter();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.