ClassRegistry Class Reference

List of all members.

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()

Detailed Description

Definition at line 37 of file class_registry.php.


Member Function Documentation

& ClassRegistry::__duplicate ( alias,
class 
) [static]

Checks to see if $alias is a duplicate $class Object

Parameters:
string $alias
string $class
Returns:
boolean private

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.

Parameters:
string $key Key to find in map
Returns:
string Mapped value private

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.

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 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

Parameters:
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
Returns:
mixed Void if $param is being set. Otherwise, if only $type is passed, returns the previously-set value of $param, or null if not set. public

Definition at line 267 of file class_registry.php.

References getInstance().

ClassRegistry::flush (  )  [static]

Flushes all objects from the ClassRegistry.

Returns:
void public

Definition at line 347 of file class_registry.php.

References getInstance().

& ClassRegistry::getInstance (  ) 

Return a singleton instance of the ClassRegistry.

Returns:
ClassRegistry instance public

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.

Parameters:
string $key Key of object to look for
Returns:
mixed Object stored in registry public

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') ); }}}

Parameters:
mixed $class as a string or a single key => value array instance will be created, stored in the registry and returned.
string $type TypeOfClass
Returns:
object instance of ClassName public

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.

Parameters:
string $key Key to look for
Returns:
boolean true if key exists in registry, false otherwise public

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.

Returns:
array Set of keys stored in registry public

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.

Parameters:
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.

Returns:
array Keys of registry's map public

Definition at line 323 of file class_registry.php.

References getInstance().

ClassRegistry::removeObject ( key  )  [static]

Remove object which corresponds to given key.

Parameters:
string $key Key of object to remove from registry
Returns:
void public

Definition at line 198 of file class_registry.php.

References getInstance(), and underscore().


Member Data Documentation

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.


The documentation for this class was generated from the following file:
Generated on Sun Nov 22 00:30:55 2009 for CakePHP 1.2.x.x (v1.2.4.8284) by doxygen 1.4.7