Application/Resource/Multidb.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Application  
Subpackage
Resource  
Version
$Id: Multidb.php 24593 2012-01-05 20:35:02Z matthew $  

\Zend_Application_Resource_Multidb

Package: Zend\Application\Resource
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"
Parent(s)
\Zend_Application_Resource_ResourceAbstract
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotected\Zend_Application_Bootstrap_Bootstrapper $_bootstrap
inherited
Parent bootstrap
Inherited from: \Zend_Application_Resource_ResourceAbstract::$$_bootstrap
>VPropertyprotectedarray $_dbs = array()
Associative array containing all configured db's
Default valuearray()Details
Type
array
>VPropertyprotectednull|\Zend_Db_Adapter_Abstract $_defaultDb
An instance of the default db, if set
Details
Type
null | \Zend_Db_Adapter_Abstract
>VPropertyprotectedarray $_options = array()
inherited
Options for the resource
Inherited from: \Zend_Application_Resource_ResourceAbstract::$$_options
Default valuearray()Details
Type
array
Inherited_from
\Zend_Application_Resource_ResourceAbstract::$$_options  
>VPropertyprotectedarray $_skipOptions = array('options', 'config')
inherited
Option keys to skip when calling setOptions()
Inherited from: \Zend_Application_Resource_ResourceAbstract::$$_skipOptions
Default valuearray('options', 'config')Details
Type
array
Inherited_from
\Zend_Application_Resource_ResourceAbstract::$$_skipOptions  

Methods

methodpublic__construct(mixed $options = null) : void
inherited

Create a instance with options

Inherited from: \Zend_Application_Resource_ResourceAbstract::__construct()

Must take an optional single argument, $options.

Parameters
NameTypeDescription
$optionsmixed
methodprotected_setDefault( $adapter) : void

Set the default db adapter

Parameters
NameTypeDescription
$adapter
Details
\Zend_Db_Adapter_Abstract

Adapter to set as default

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

Set the default metadata cache

Parameters
NameTypeDescription
$cachestring | \Zend_Cache_Core
Returns
TypeDescription
\Zend_Application_Resource_Multidb
methodpublicgetBootstrap() : null | \Zend_Application_Bootstrap_Bootstrapper
inherited

Retrieve the bootstrap to which the resource is attached

Inherited from: \Zend_Application_Resource_ResourceAbstract::getBootstrap()
Returns
TypeDescription
null | \Zend_Application_Bootstrap_Bootstrapper
methodpublicgetDb(null | string | \Zend_Db_Adapter_Abstract $db = null) : \Zend_Db_Adapter_Abstract

Retrieve the specified database connection

Parameters
NameTypeDescription
$dbnull | string | \Zend_Db_Adapter_Abstract

The adapter to retrieve. Null to retrieve the default connection

Returns
TypeDescription
\Zend_Db_Adapter_Abstract
Throws
ExceptionDescription
\Zend_Application_Resource_Exceptionif the given parameter could not be found
methodpublicgetDefaultDb(boolean $justPickOne = true) : null | \Zend_Db_Adapter_Abstract

Get the default db connection

Parameters
NameTypeDescription
$justPickOneboolean

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
TypeDescription
null | \Zend_Db_Adapter_Abstract
methodpublicgetOptions() : array
inherited

Retrieve resource options

Inherited from: \Zend_Application_Resource_ResourceAbstract::getOptions()
Returns
TypeDescription
array
methodpublicinit() : \Zend_Application_Resource_Multidb

Initialize the Database Connections (instances of Zend_Db_Table_Abstract)

methodpublicisDefault(string | \Zend_Db_Adapter_Abstract $db) : boolean

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

Parameters
NameTypeDescription
$dbstring | \Zend_Db_Adapter_Abstract

The db to determine whether it's set as default

Returns
TypeDescription
booleanTrue if the given parameter is configured as default. False otherwise
methodpublicmergeOptions(array $array1, mixed $array2 = null) : array
inherited

Merge options recursively

Inherited from: \Zend_Application_Resource_ResourceAbstract::mergeOptions()
Parameters
NameTypeDescription
$array1array
$array2mixed
Returns
TypeDescription
array
methodpublicsetBootstrap(\Zend_Application_Bootstrap_Bootstrapper $bootstrap) : \Zend_Application_Resource_Resource
inherited

Set the bootstrap to which the resource is attached

Inherited from: \Zend_Application_Resource_ResourceAbstract::setBootstrap()
Parameters
NameTypeDescription
$bootstrap\Zend_Application_Bootstrap_Bootstrapper
Returns
TypeDescription
\Zend_Application_Resource_Resource
methodpublicsetOptions(array $options) : \Zend_Application_Resource_ResourceAbstract
inherited

Set options from array

Inherited from: \Zend_Application_Resource_ResourceAbstract::setOptions()
Parameters
NameTypeDescription
$optionsarray

Configuration for resource

Returns
TypeDescription
\Zend_Application_Resource_ResourceAbstract
Documentation was generated by phpDocumentor 2.0.0a12.