Configure Class Info:
- Class Declaration:
- class Configure extends Object
- File name:
- cake/libs/configure.php
- Summary:
- Configuration class (singleton). Used for managing runtime configuration information.
- Class Inheritance
- package
- cake
- subpackage
- cake.cake.libs
- link
- http://book.cakephp.org/view/42/The-Configuration-Class
Properties:
Show/Hide parent properties
| public | behaviorPaths | List of additional path(s) where behavior files reside. |
| public | componentPaths | List of additional path(s) where component files reside. |
| public | controllerPaths | List of additional path(s) where controller files reside. |
| public | debug | Current debug level. |
| public | helperPaths | List of additional path(s) where helper files reside. |
| public | localePaths | List of additional path(s) where locale files reside. |
| protected | _log | Log object |
| public | modelPaths | List of additional path(s) where model files reside. |
| public | pluginPaths | List of additional path(s) where plugins reside. |
| public | shellPaths | List of additional path(s) where console shell files reside. |
| public | vendorPaths | List of additional path(s) where vendor packages reside. |
| public | viewPaths | List of additional path(s) where view files reside. |
Method Summary:
Show/Hide parent methods
| public | buildPaths( $paths ) |
| public | cakeError( $method, $messages = array ( ) ) |
| public | __construct( ) |
| public | corePaths( $type = NULL ) |
| public | delete( $var = NULL ) |
| public | __destruct( ) |
| public | dispatchMethod( $method, $params = array ( ) ) |
| public | getInstance( $boot = true ) |
| public | __list( $path, $suffix = false, $extension = false ) |
| public | listObjects( $type, $path = NULL, $cache = true ) |
| public | load( $fileName ) |
| public | log( $msg, $type = 2 ) |
| public | Object( ) |
| protected | _persist( $name, $return, $object, $type = NULL ) |
| public | read( $var = 'debug' ) |
| public | requestAction( $url, $extra = array ( ) ) |
| protected | _savePersistent( $name, $object ) |
| protected | _set( $properties = array ( ) ) |
| public | _stop( $status = 0 ) |
| public | store( $type, $name, $data = array ( ) ) |
| public | toString( ) |
| public | version( ) |
| public | write( $config, $value = NULL ) |
buildPaths
topBuild path references. Merges the supplied $paths
with the base paths and the default core paths.
- Parameters:
-
$paths array paths defines in config/bootstrap.php required (no default) - Method defined in class:
- Configure
- Method defined in file:
- cake/libs/configure.php on line 592
- return
- void
- access
- public
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
topClass constructor, overridden in descendant classes.
- Method defined in class:
- Object
- Method defined in file:
- cake/libs/object.php on line 63
corePaths
topReturns a key/value list of all paths where core libs are found.
Passing $type only returns the values for a given value of $key.
- Parameters:
-
$type string valid values are: 'model', 'behavior', 'controller', 'component', 'view', 'helper', 'datasource', 'libs', and 'cake' optional NULL - Method defined in class:
- Configure
- Method defined in file:
- cake/libs/configure.php on line 491
- return
- array numeric keyed array of core lib paths
- access
- public
delete
topUsed to delete a variable from the Configure instance.
Usage:
Configure::delete('Name'); will delete the entire Configure::Name
Configure::delete('Name.key'); will delete only the Configure::Name[key]
- Parameters:
-
$var string the var to be deleted optional NULL - Method defined in class:
- Configure
- Method defined in file:
- cake/libs/configure.php on line 372
- link
- http://book.cakephp.org/view/414/delete
- return
- void
- access
- public
__destruct
topCaches the object map when the instance of the Configure class is destroyed
- Method defined in class:
- Configure
- Method defined in file:
- cake/libs/configure.php on line 706
- access
- public
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
getInstance
topReturns a singleton instance of the Configure class.
- Parameters:
-
$boot optional true - Method defined in class:
- Configure
- Method defined in file:
- cake/libs/configure.php on line 133
- return
- Configure instance
- access
- public
__list
topReturns an array of filenames of PHP files in the given directory.
- Parameters:
-
$path string Path to scan for files required (no default) $suffix string if false, return only directories. if string, match and return files optional false $extension optional false - Method defined in class:
- Configure
- Method defined in file:
- cake/libs/configure.php on line 221
- return
- array List of directories or files in directory
listObjects
topReturns an index of objects of the given type, with the physical path to each object.
- Parameters:
-
$type string Type of object, i.e. 'model', 'controller', 'helper', or 'plugin' required (no default) $path mixed Optional optional NULL $cache optional true - Method defined in class:
- Configure
- Method defined in file:
- cake/libs/configure.php on line 149
- return
- Configure instance
- access
- public
load
topLoads a file from app/config/configure_file.php.
Config file variables should be formated like:
$config['name'] = 'value';
These will be used to create dynamic Configure vars.
Usage Configure::load('configure_file');
- Parameters:
-
$fileName string name of file to load, extension must be .php and only the name should be used, not the extenstion required (no default) - Method defined in class:
- Configure
- Method defined in file:
- cake/libs/configure.php on line 396
- link
- http://book.cakephp.org/view/415/load
- return
- mixed false if file not found, void if load successful
- access
- public
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
read
topUsed to read information stored in the Configure instance.
Usage
Configure::read('Name'); will return all values for Name
Configure::read('Name.key'); will return only the value of Configure::Name[key]
- Parameters:
-
$var string Variable to obtain optional 'debug' - Method defined in class:
- Configure
- Method defined in file:
- cake/libs/configure.php on line 326
- link
- http://book.cakephp.org/view/413/read
- return
- string value of Configure::$var
- access
- public
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
_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
store
topUsed to write a config file to disk.
Configure::store('Model', 'class.paths', array('Users' => array(
'path' => 'users', 'plugin' => true
)));
- Parameters:
-
$type string Type of config file to write, ex: Models, Controllers, Helpers, Components required (no default) $name string file name. required (no default) $data array array of values to store. optional array ( ) - Method defined in class:
- Configure
- Method defined in file:
- cake/libs/configure.php on line 457
- 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
version
topUsed to determine the current version of CakePHP.
Usage Configure::version();
- Method defined in class:
- Configure
- Method defined in file:
- cake/libs/configure.php on line 435
- link
- http://book.cakephp.org/view/416/version
- return
- string Current version of CakePHP
- access
- public
write
topUsed to store a dynamic variable in the Configure instance.
Usage:
{{{
Configure::write('One.key1', 'value of the Configure::One[key1]');
Configure::write(array('One.key1' => 'value of the Configure::One[key1]'));
Configure::write('One', array(
'key1' => 'value of the Configure::One[key1]',
'key2' => 'value of the Configure::One[key2]'
);
Configure::write(array(
'One.key1' => 'value of the Configure::One[key1]',
'One.key2' => 'value of the Configure::One[key2]'
));
}}}
- Parameters:
-
$config array Name of var to write required (no default) $value mixed Value to set for var optional NULL - Method defined in class:
- Configure
- Method defined in file:
- cake/libs/configure.php on line 270
- link
- http://book.cakephp.org/view/412/write
- return
- void
- access
- public