I have 3 type of databases:
Authen DB (fixed address and fixed schema)
Config DB (fixed address and fixed schema)
Service DBs (dynamic address and dynamic schema based on each service)
After users logined and verified via Authen DB.
Based on the information store in Config DB, all actions in ZF2 application relate to the service should be done on the correlative Service DBs.
Does ZF2 support this case? How can I solve this?
Below codes are my global.php and local.php.
global.php
return array(
'db' => array(
// primary database
'driver' => 'Pdo',
'dsn' => 'mysql:host=xxx.xxx.xxx.xxx;dbname=db_authen',
'driver_options' => array(
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'",
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
),
// other database
'adapters' => array(
'db_config' => array(
'driver' => 'Pdo',
'dsn' => 'mysql:host=yyy.yyy.yyy.yyy;dbname=db_config',
'driver_options' => array(
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'",
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
),
),
),
),
'service_manager' => array(
// primary database
'factories' => array(
'Zend\Db\Adapter\Adapter' => 'Zend\Db\Adapter\AdapterServiceFactory',
'navigation' => 'Zend\Navigation\Service\DefaultNavigationFactory'
),
// other database
'abstract_factories' => array(
'Zend\Db\Adapter\AdapterAbstractServiceFactory',
),
),
);
local.php
return array(
'db' => array(
// primary database
'username' => '*****',
'password' => '*****',
// other database
'adapters' => array(
'db_config' => array(
'username' => '*****',
'password' => '*****',
),
),
),
);
Thanks,