Hi everyone,
I'm working on a Zend Framework project and I need to use two databases. I was wondering if it is possible to change the database configuration of application.ini within the bootstrap.
This is what I am using at the moment:
Bootstrap
public function _initDbRegistry()
{
$this->bootstrap('multidb');
$multidb = $this->getPluginResource('multidb');
Zend_Registry::set('db_local', $multidb->getDb('local'));
Zend_Registry::set('db_remote', $multidb->getDb('remote'));
}
application.ini
resources.multidb.local.adapter = pdo_mysql
resources.multidb.local.host = localhost
resources.multidb.local.username = root
resources.multidb.local.password =
resources.multidb.local.dbname = system
resources.multidb.local.default = true
resources.multidb.remote.adapter = pdo_mysql
resources.multidb.remote.host = localhost
resources.multidb.remote.username = root
resources.multidb.remote.password =
resources.multidb.remote.dbname = customer
resources.multidb.remote.default = false
Ok the problem is that I want to change the dbname of remote. Is there any way of doing that? Is it possible to add the remote db configuration within the bootstrap? Why I want this is because the dbname needs to be variable.
Anyone here with a solution??
Thanks!