I have a Zend_Framework application, which has a whole bunch of model classes.
I need these model classes to be able to access the application's database (naturally).
Currently I've put this in my index.php:
Zend_Registry::set('db',
$application->bootstrap()->getBootstrap()
->getPluginResource('db')->getDbAdapter());
And then $db = Zend_Registry::get('db');
in each of my model classes that require the database.
But this seems like a horrible horrible hack. Am I missing something basic here?