ClassRegistry Class Reference
Public Member Functions | |
| _duplicate ($alias, $class) | |
| addObject ($key, &$object) | |
| flush () | |
| & | getInstance () |
| & | getObject ($key) |
| & | init ($class, $type=null) |
| isKeySet ($key) | |
| keys () | |
| map ($key, $name) | |
| mapKeys () | |
| removeObject ($key) | |
Detailed Description
Definition at line 39 of file class_registry.php.
Member Function Documentation
| ClassRegistry::_duplicate | ( | $ | alias, | |
| $ | class | |||
| ) |
Checks to see if $alias is a duplicate $class Object
- Parameters:
-
string $alias string $class
- Returns:
- boolean
Definition at line 247 of file class_registry.php.
References getInstance(), and isKeySet().
Referenced by init().
| ClassRegistry::addObject | ( | $ | key, | |
| &$ | object | |||
| ) |
Add $object to the registry, associating it with the name $key.
- Parameters:
-
string $key Key for the object in registry mixed $object Object to store
- Returns:
- boolean True if the object was written, false if $key already exists public
Definition at line 168 of file class_registry.php.
References getInstance(), and Inflector::underscore().
| ClassRegistry::flush | ( | ) |
Flushes all objects from the ClassRegistry.
public
Definition at line 303 of file class_registry.php.
References getInstance().
| & ClassRegistry::getInstance | ( | ) |
Return a singleton instance of the ClassRegistry.
- Returns:
- ClassRegistry instance public
Definition at line 60 of file class_registry.php.
Referenced by _duplicate(), addObject(), flush(), getObject(), init(), isKeySet(), keys(), Controller::loadModel(), map(), mapKeys(), and removeObject().
| & ClassRegistry::getObject | ( | $ | key | ) |
Return object which corresponds to given key.
- Parameters:
-
string $key Key of object to look for
- Returns:
- mixed Object stored in registry public
Definition at line 224 of file class_registry.php.
References getInstance(), and Inflector::underscore().
Referenced by BehaviorCollection::attach(), JavascriptHelper::blockEnd(), RssHelper::channel(), FormHelper::checkbox(), JavascriptHelper::codeBlock(), FormHelper::create(), BehaviorCollection::detach(), Helper::domId(), FormHelper::end(), Helper::field(), SessionHelper::flash(), FormHelper::input(), FormHelper::label(), Shell::loadTasks(), HtmlHelper::meta(), Helper::model(), Helper::modelID(), Controller::render(), Helper::setEntity(), Helper::tagIsInvalid(), Helper::value(), and JavascriptHelper::writeEvents().
| & ClassRegistry::init | ( | $ | class, | |
| $ | type = null | |||
| ) |
Loads a class, registers the object in the registry and returns instance of the object.
- Parameters:
-
mixed $class as a string or a single key => value array instance will be created, stored in the registry and returned. Required: array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'TypeOfClass'); Model Classes can accept optional array('id' => $id, 'table' => $table, 'ds' => $ds, 'alias' => $alias); When $class is a numeric keyed array, multiple class instances will be stored in the registry, no instance of the object will be returned array( array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'TypeOfClass'), array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'TypeOfClass'), array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'TypeOfClass')); string $type TypeOfClass
- Returns:
- object intance of ClassName
Definition at line 83 of file class_registry.php.
References _duplicate(), a(), getInstance(), and App::import().
Referenced by Shell::_loadModels(), AuthComponent::getModel(), Controller::loadModel(), AclNode::node(), CakeSchema::read(), and TranslateBehavior::translateModel().
| ClassRegistry::isKeySet | ( | $ | key | ) |
Returns true if given key is present in the ClassRegistry.
- Parameters:
-
string $key Key to look for
- Returns:
- boolean true if key exists in registry, false otherwise public
Definition at line 197 of file class_registry.php.
References getInstance(), and Inflector::underscore().
Referenced by _duplicate(), FormHelper::checkbox(), FormHelper::create(), FormHelper::input(), Shell::loadTasks(), Controller::render(), Helper::setEntity(), and Helper::value().
| ClassRegistry::keys | ( | ) |
Get all keys from the regisrty.
- Returns:
- array Set of keys stored in registry public
Definition at line 213 of file class_registry.php.
References getInstance().
Referenced by FormHelper::create(), and Controller::render().
| ClassRegistry::map | ( | $ | key, | |
| $ | name | |||
| ) |
Add a key name pair to the registry to map name to class in the regisrty.
- Parameters:
-
string $key Key to include in map string $name Key that is being mapped public
Definition at line 267 of file class_registry.php.
References getInstance(), and Inflector::underscore().
Referenced by Shell::loadTasks().
| ClassRegistry::mapKeys | ( | ) |
Get all keys from the map in the regisrty.
- Returns:
- array Keys of registry's map public
Definition at line 281 of file class_registry.php.
References getInstance().
| ClassRegistry::removeObject | ( | $ | key | ) |
Remove object which corresponds to given key.
- Parameters:
-
string $key Key of object to remove from registry public
Definition at line 183 of file class_registry.php.
References getInstance(), and Inflector::underscore().
The documentation for this class was generated from the following file:
- 1.2.x.x/cake/libs/class_registry.php