Cache Manager resource

Example configuration:

  resources.multidb.defaultMetadataCache = "database"

  resources.multidb.db1.adapter = "pdo_mysql"
  resources.multidb.db1.host = "localhost"
  resources.multidb.db1.username = "webuser"
  resources.multidb.db1.password = "XXXX"
  resources.multidb.db1.dbname = "db1"
  resources.multidb.db1.default = true

  resources.multidb.db2.adapter = "pdo_pgsql"
  resources.multidb.db2.host = "example.com"
  resources.multidb.db2.username = "dba"
  resources.multidb.db2.password = "notthatpublic"
  resources.multidb.db2.dbname = "db2"
category Zend
package Zend_Application
subpackage Resource
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Application_Resource_ResourceAbstract

 Methods

Create a instance with options

__construct(mixed $options = null
Inherited

Must take an optional single argument, $options.

inherited_from \Zend_Application_Resource_Resource::__construct()

Parameters

$options

mixed

Retrieve the bootstrap to which the resource is attached

getBootstrap() : null | \Zend_Application_Bootstrap_Bootstrapper
Inherited
inherited_from \Zend_Application_Resource_Resource::getBootstrap()

Returns

null\Zend_Application_Bootstrap_Bootstrapper

Retrieve the specified database connection

getDb(null|string|\Zend_Db_Adapter_Abstract $db = null) : \Zend_Db_Adapter_Abstract

Parameters

$db

nullstring\Zend_Db_Adapter_Abstract

The adapter to retrieve. Null to retrieve the default connection

Exceptions

\Zend_Application_Resource_Exception if the given parameter could not be found

Returns

\Zend_Db_Adapter_Abstract

Get the default db connection

getDefaultDb(boolean $justPickOne = true) : null | \Zend_Db_Adapter_Abstract

Parameters

$justPickOne

boolean

If true, a random (the first one in the stack) connection is returned if no default was set. If false, null is returned if no default was set.

Returns

null\Zend_Db_Adapter_Abstract

Retrieve resource options

getOptions() : array
Inherited
inherited_from \Zend_Application_Resource_Resource::getOptions()

Returns

array

Initialize the Database Connections (instances of Zend_Db_Table_Abstract)

init() : \Zend_Application_Resource_Multidb

Returns

\Zend_Application_Resource_Multidb

Determine if the given db(identifier) is the default db.

isDefault(string|\Zend_Db_Adapter_Abstract $db) : boolean

Parameters

$db

string\Zend_Db_Adapter_Abstract

The db to determine whether it's set as default

Returns

booleanTrue if the given parameter is configured as default. False otherwise

Merge options recursively

mergeOptions(array $array1, mixed $array2 = null) : array
Inherited

Parameters

$array1

array

$array2

mixed

Returns

array

Set the bootstrap to which the resource is attached

setBootstrap(\Zend_Application_Bootstrap_Bootstrapper $bootstrap) : \Zend_Application_Resource_Resource
Inherited
inherited_from \Zend_Application_Resource_Resource::setBootstrap()

Parameters

$bootstrap

\Zend_Application_Bootstrap_Bootstrapper

Returns

\Zend_Application_Resource_Resource

Set options from array

setOptions(array $options) : \Zend_Application_Resource_ResourceAbstract
Inherited
inherited_from \Zend_Application_Resource_Resource::setOptions()

Parameters

$options

array

Configuration for resource

Returns

\Zend_Application_Resource_ResourceAbstract

Set the default db adapter

_setDefault(\Zend_Db_Adapter_Abstract $adapter) 
var

Adapter to set as default

Parameters

$adapter

Set the default metadata cache

_setDefaultMetadataCache(string|\Zend_Cache_Core $cache) : \Zend_Application_Resource_Multidb

Parameters

$cache

string\Zend_Cache_Core

Returns

\Zend_Application_Resource_Multidb

 Properties

 

Parent bootstrap

$_bootstrap : \Zend_Application_Bootstrap_Bootstrapper

Default

 

Associative array containing all configured db's

$_dbs : array

Default

array()
 

An instance of the default db, if set

$_defaultDb : null | \Zend_Db_Adapter_Abstract

Default

 

Options for the resource

$_options : array

Default

array()
 

Option keys to skip when calling setOptions()

$_skipOptions : array

Default

array('options', 'config')