Manages loaded instances of DataSource objects
Provides an interface for loading and enumerating connections defined in app/Config/database.php
array
array
boolean
DATABASE_CONFIG
Gets the list of available DataSource connections This will only return the datasources instantiated by this manager It differs from enumConnectionObjects, since the latter will return all configured connections
_connectionData( array $config )
Returns the file, class name, and parent for the given driver.
$config
_getConnectionObject( string $name )
Gets a list of class and file names associated with the user-defined DataSource connections
$name
MissingDatasourceConfigException
create( string $name '' , array $config array() )
Dynamically creates a DataSource object at runtime, with the given name and settings
$name
optional '' $config
optional array() DataSource
|nulldrop( string $name )
Removes a connection configuration at runtime given its name
$name
enumConnectionObjects( )
Returns a list of connections
An associative array of elements where the key is the connection name (as defined in Connections), and the value is an array with keys 'filename' and 'classname'.
getDataSource( string $name )
Gets a reference to a DataSource object
$name
DataSource
MissingDatasourceException
getSourceName( DataSource $source )
Gets a DataSource name from an object reference.
DataSource
$source
Datasource name, or null if source is not present in the ConnectionManager.
loadDataSource( string|array $connName )
Loads the DataSource class for the given connection name
$connName
A string name of the connection, as defined in app/Config/database.php, or an array containing the filename (without extension) and class name of the object, to be found in app/Model/Datasource/ or lib/Cake/Model/Datasource/.
MissingDatasourceException
sourceList( )
Gets the list of available DataSource connections This will only return the datasources instantiated by this manager It differs from enumConnectionObjects, since the latter will return all configured connections
protected static array
Contains a list of all file and class names used in Connection settings
array()
protected static boolean
Indicates if the init code for this class has already been executed
false
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/2.8/class-ConnectionManager.html