ConnectionManager Class Info:
- Class Declaration:
- class ConnectionManager extends Object
- File name:
- cake/libs/model/connection_manager.php
- Summary:
- Manages loaded instances of DataSource objects Long description for file
- Class Inheritance
- package
- cake
- subpackage
- cake.cake.libs.model
Properties:
Show/Hide parent properties
| public | config | Holds a loaded instance of the Connections object |
| protected | _connectionsEnum | Contains a list of all file and class names used in Connection settings |
| protected | _dataSources | Holds instances DataSource objects |
| protected | _log | Log object |
Method Summary:
Show/Hide parent methods
| public | cakeError( $method, $messages = array ( ) ) |
| public | __construct( ) |
| public | create( $name = '', $config = array ( ) ) |
| public | dispatchMethod( $method, $params = array ( ) ) |
| public | enumConnectionObjects( ) |
| public | getDataSource( $name ) |
| public | getInstance( ) |
| public | getSourceName( $source ) |
| public | loadDataSource( $connName ) |
| public | log( $msg, $type = 2 ) |
| public | Object( ) |
| protected | _persist( $name, $return, $object, $type = NULL ) |
| public | requestAction( $url, $extra = array ( ) ) |
| protected | _savePersistent( $name, $object ) |
| protected | _set( $properties = array ( ) ) |
| public | sourceList( ) |
| public | _stop( $status = 0 ) |
| public | toString( ) |
cakeError
topUsed to report user friendly errors.
If there is a file app/error.php or app/app_error.php this file will be loaded
error.php is the AppError class it should extend ErrorHandler class.
- Parameters:
-
$method string Method to be called in the error class (AppError or ErrorHandler classes) required (no default) $messages array Message that is to be displayed by the error class optional array ( ) - Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 189
- return
- error message
- access
- public
__construct
topConstructor.
- Method defined in class:
- ConnectionManager
- Method defined in file:
- cake/libs/model/connection_manager.php on line 64
create
topDynamically creates a DataSource object at runtime, with the given name and settings
- Parameters:
-
$name string The DataSource name optional '' $config array The DataSource configuration settings optional array ( ) - Method defined in class:
- ConnectionManager
- Method defined in file:
- cake/libs/model/connection_manager.php on line 217
- return
- object A reference to the DataSource object, or null if creation failed
- access
- public
- static
dispatchMethod
topCalls a method on this object with the given parameters. Provides an OO wrapper
for call_user_func_array, and improves performance by using straight method calls
in most cases.
- Parameters:
-
$method string Name of the method to call required (no default) $params array Parameter list to use when calling $method optional array ( ) - Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 113
- return
- mixed Returns the result of the method call
- access
- public
enumConnectionObjects
topGets a list of class and file names associated with the user-defined DataSource connections
- Method defined in class:
- ConnectionManager
- Method defined in file:
- cake/libs/model/connection_manager.php on line 191
- return
- array 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'.
- access
- public
- static
getDataSource
topGets a reference to a DataSource object
- Parameters:
-
$name string The name of the DataSource, as defined in app/config/database.php required (no default) - Method defined in class:
- ConnectionManager
- Method defined in file:
- cake/libs/model/connection_manager.php on line 93
- return
- object Instance
- access
- public
- static
getInstance
topGets a reference to the ConnectionManger object instance
- Method defined in class:
- ConnectionManager
- Method defined in file:
- cake/libs/model/connection_manager.php on line 76
- return
- object Instance
- access
- public
- static
getSourceName
topGets a DataSource name from an object reference
- Parameters:
-
$source object DataSource object required (no default) - Method defined in class:
- ConnectionManager
- Method defined in file:
- cake/libs/model/connection_manager.php on line 135
- return
- string Datasource name
- access
- public
- static
loadDataSource
topLoads the DataSource class for the given connection name
- Parameters:
-
$connName mixed 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/models/datasources/ or cake/libs/model/datasources/. required (no default) - Method defined in class:
- ConnectionManager
- Method defined in file:
- cake/libs/model/connection_manager.php on line 155
- return
- boolean True on success, null on failure or false if the class is already loaded
- access
- public
- static
log
topAPI for logging events.
- Parameters:
-
$msg string Log message required (no default) $type integer Error type constant. Defined in app/config/core.php. optional 2 - Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 150
- return
- boolean Success of log write
- access
- public
Object
topA hack to support __construct() on PHP 4
Hint: descendant classes have no PHP4 class_name() constructors,
so this constructor gets called first and calls the top-layer __construct()
which (if present) should call parent::__construct()
- Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 53
- return
- Object
_persist
topChecks for a persistent class file, if found file is opened and true returned
If file is not found a file is created and false returned
If used in other locations of the model you should choose a unique name for the persistent file
There are many uses for this method, see manual for examples
- Parameters:
-
$name string name of the class to persist required (no default) $return required (no default) $object string the object to persist required (no default) $type optional NULL - Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 219
- return
- boolean Success
- access
- protected
- todo
- add examples to manual
requestAction
topCalls a controller's method from any location.
- Parameters:
-
$url mixed String or array-based url. required (no default) $extra array if array includes the key "return" it sets the AutoRender to true. optional array ( ) - Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 86
- return
- mixed Boolean true or false on success/failure, or contents of rendered action if 'return' is set in $extra.
- access
- public
_savePersistent
topYou should choose a unique name for the persistent file
There are many uses for this method, see manual for examples
- Parameters:
-
$name string name used for object to cache required (no default) $object object the object to persist required (no default) - Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 247
- return
- boolean true on save, throws error if file can not be created
- access
- protected
_set
topAllows setting of multiple properties of the object in a single line of code.
- Parameters:
-
$properties array An associative array containing properties and corresponding values. optional array ( ) - Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 169
- return
- void
- access
- protected
sourceList
topGets the list of available DataSource connections
- Method defined in class:
- ConnectionManager
- Method defined in file:
- cake/libs/model/connection_manager.php on line 123
- return
- array List of available connections
- access
- public
- static
_stop
topStop execution of the current script
- Parameters:
-
$status optional 0 - Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 139
- return
- void
- access
- public
toString
topObject-to-string conversion.
Each class can override this method as necessary.
- Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 73
- return
- string The name of this class
- access
- public