If you have bootstrapped your resources in the "standard" way using references in your
./application/config/application.ini file of the form:
resources.db.adapter = mysql
resources.db.params.host = localhost
then you should be able to get the adapter object from the
Zend_Application object using:
$adapter = $application->getBootstrap()->getResource('db');
Then you can write your db queries against that adapter.
[Or - even better - feed that adapter into a model that encapsulates/hides the specific db-queries inside a well-defined interface whose implementations will be more testable.]
Per request, here is an example of injecting a db-adapter into a model.
public function __construct($db)
$this->db = $db;
class Application_Model_Users extends Application_Model_BaseModel
public function getVerifiedUsers()
$select = $this->db->select()
'verified' => true,
Usage would then be:
$model = new Application_Model_Users($db);
$users = $model->getVerifiedUsers();
This could be probably tightened further by using
Zend_Db_Table_Abstract as the base model, but I intentionally provided a bare-bones example to show what I mean about injecting a db adapter into a model.