Public Member Functions | |
| & | getInstance () |
Static Public Member Functions | |
| & | __duplicate ($alias, $class) |
| __getMap ($key) | |
| addObject ($key, &$object) | |
| config ($type, $param=array()) | |
| flush () | |
| & | getObject ($key) |
| & | init ($class, $type=null) |
| isKeySet ($key) | |
| keys () | |
| map ($key, $name) | |
| mapKeys () | |
| removeObject ($key) | |
Public Attributes | |
| $__config = array() | |
| $__map = array() | |
| $__objects = array() | |
Definition at line 37 of file class_registry.php.
| & ClassRegistry::__duplicate | ( | $ | alias, | |
| $ | class | |||
| ) | [static] |
Checks to see if $alias is a duplicate $class Object
| string | $alias | |
| string | $class |
Definition at line 289 of file class_registry.php.
References getObject(), and isKeySet().
Referenced by init().
| ClassRegistry::__getMap | ( | $ | key | ) | [static] |
Return the name of a class in the registry.
| string | $key Key to find in map |
Definition at line 335 of file class_registry.php.
| ClassRegistry::addObject | ( | $ | key, | |
| &$ | object | |||
| ) | [static] |
Add $object to the registry, associating it with the name $key.
| string | $key Key for the object in registry | |
| mixed | $object Object to store |
Definition at line 181 of file class_registry.php.
References getInstance(), and underscore().
Referenced by Model::__construct(), Object::__openPersistent(), BehaviorCollection::attach(), and init().
| ClassRegistry::config | ( | $ | type, | |
| $ | param = array() | |||
| ) | [static] |
Sets the default constructor parameter for an object type
| string | $type Type of object. If this parameter is omitted, defaults to "Model" | |
| array | $param The parameter that will be passed to object constructors when objects of $type are created |
Definition at line 267 of file class_registry.php.
References getInstance().
| ClassRegistry::flush | ( | ) | [static] |
Flushes all objects from the ClassRegistry.
Definition at line 347 of file class_registry.php.
References getInstance().
| & ClassRegistry::getInstance | ( | ) |
Return a singleton instance of the ClassRegistry.
Definition at line 65 of file class_registry.php.
Referenced by addObject(), config(), flush(), getObject(), init(), isKeySet(), keys(), Controller::loadModel(), map(), mapKeys(), and removeObject().
| & ClassRegistry::getObject | ( | $ | key | ) | [static] |
Return object which corresponds to given key.
| string | $key Key of object to look for |
Definition at line 242 of file class_registry.php.
References getInstance(), and underscore().
Referenced by __duplicate(), ViewTask::__loadController(), Helper::__name(), FormHelper::__secure(), BehaviorCollection::attach(), RssHelper::channel(), JavascriptHelper::codeBlock(), FormHelper::create(), BehaviorCollection::detach(), Helper::domId(), FormHelper::end(), Helper::field(), FormHelper::file(), 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 | |||
| ) | [static] |
Loads a class, registers the object in the registry and returns instance of the object.
Examples Simple Use: Get a Post model instance ```ClassRegistryinit('Post');```
Exapanded: ```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') ); }}}
| mixed | $class as a string or a single key => value array instance will be created, stored in the registry and returned. | |
| string | $type TypeOfClass |
Definition at line 98 of file class_registry.php.
References $id, __(), __duplicate(), a(), addObject(), create(), getInstance(), App::import(), and name().
Referenced by DbAcl::__construct(), Model::__constructLinkedModel(), Shell::_loadModels(), AuthComponent::getModel(), Controller::loadModel(), AclNode::node(), CakeSchema::read(), and TranslateBehavior::translateModel().
| ClassRegistry::isKeySet | ( | $ | key | ) | [static] |
Returns true if given key is present in the ClassRegistry.
| string | $key Key to look for |
Definition at line 213 of file class_registry.php.
References getInstance(), and underscore().
Referenced by __duplicate(), Model::__generateAssociation(), BehaviorCollection::attach(), FormHelper::create(), FormHelper::input(), Shell::loadTasks(), Controller::render(), Helper::setEntity(), and Helper::value().
| ClassRegistry::keys | ( | ) | [static] |
Get all keys from the registry.
Definition at line 230 of file class_registry.php.
References getInstance().
Referenced by FormHelper::create(), and Controller::render().
| ClassRegistry::map | ( | $ | key, | |
| $ | name | |||
| ) | [static] |
Add a key name pair to the registry to map name to class in the registry.
| string | $key Key to include in map | |
| string | $name Key that is being mapped public |
Definition at line 308 of file class_registry.php.
References getInstance(), and underscore().
| ClassRegistry::mapKeys | ( | ) | [static] |
Get all keys from the map in the registry.
Definition at line 323 of file class_registry.php.
References getInstance().
| ClassRegistry::removeObject | ( | $ | key | ) | [static] |
Remove object which corresponds to given key.
| string | $key Key of object to remove from registry |
Definition at line 198 of file class_registry.php.
References getInstance(), and underscore().
| ClassRegistry::$__config = array() |
Definition at line 58 of file class_registry.php.
| ClassRegistry::$__map = array() |
Definition at line 51 of file class_registry.php.
| ClassRegistry::$__objects = array() |
Definition at line 44 of file class_registry.php.
1.4.7