Hello Bence,
you can call it in any controller:

$bootstrap = $this->getInvokeArg ( 'bootstrap' );
$db = $bootstrap->getResource ( 'dbconn' );

wher: 
Bootstrap.php
has this method:

        protected function _initDbconn(){
                $resource = $this->getPluginResource('db');
                $db = $resource->getDbAdapter();
                return $db;
        }

application.ini
resources.db.adapter = "pdo_mysql"
resources.db.params.host = "localhost"
resources.db.params.username = "whatever"
resources.db.params.password = "whatever"
resources.db.params.dbname = "whatever"
resources.db.isDefaultTableAdapter = true


rgds
Armand

On Wed, 16 Sep 2009 14:39:20 +0200, BB <[email protected]> wrote:
> Hello,
> 
> how can I get the database adapter instance in the model (or anywhere
> else) without the Zend_Db_Table's getDefaultAdapter()?
> 
> Foo.php:
> class Model_Foo
> {
>   protected $_db;
>   public function __construct()
>   {
>     $this->_db = ???;
>   }
> }
> 
> in the application.ini I have the following lines:
> resources.db.adapter = "mysqli"
> resources.db.params.host = "localhost"
> resources.db.params.username = "foo"
> resources.db.params.password = "bar"
> resources.db.params.dbname = "baz"

Reply via email to