Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend Framework multiple databases

I'm currently using only one database with Zend Framework, but now I have to add ONE MORE.

I'm using this code right now:

public static function setupDatabase()
{
    $config = self::$registry->configuration;
    $db = Zend_Db::factory($config->db->adapter, $config->db->toArray());
    $db->query("SET NAMES 'utf8'");
    self::$registry->database = $db;
    Zend_Db_Table::setDefaultAdapter($db);
}

What code do I need to write in order to use ONE MORE database; and how I will reference it, when I need to make some queries or so..

like image 918
Uffo Avatar asked May 30 '10 14:05

Uffo


1 Answers

This is included in the framework as Zend_Application_Resource_Multidb.

like image 139
chelmertz Avatar answered Oct 03 '22 00:10

chelmertz