barretBSE (3) [Avatar] Offline
Hi! I'm using Zend Framework 1.9.1 and this is my application.ini file section relative to db configuration:

resources.db.adapter = "pdo_mysql" = "localhost"
resources.db.params.username = "test"
resources.db.params.password = "test"
resources.db.params.dbname = "test"
resources.db.isDefaultTableAdapter = true

My Bootstrap class is the same used in Rob's tutorial Getting Started with Zend Framework (revision 1.6.3)

Now I need an instance of the adapter to creating a Select object. Currently I'm using the following code:

$db = Zend_Db_Table::getDefaultAdapter();
$select = $db->select();

Is this the "right way" to retrieve an adapter instance or there is a better one?
Any help will be really appreciated. Thanks smilie
apprentice (77) [Avatar] Offline
Re: How to retrieve the Zend_Db_Adapter instance?
Maybe this can help you I use the same environment like you.

[1.8] - How do you store $database object to the Zend_Registry? - [SOLVED]

Then for testing you can do something like this in a View page to fetch your $select object with some modifications. In a proper web application you should move this part of the code to the Controller instead. I think, I'm still a ZF newbie.

$db = Zend_Registry::get('db');