Skip to content

Commit

Permalink
Updating documentation for ClassRegistry::init() to not imply that it
Browse files Browse the repository at this point in the history
can be used to construct non model objects.  Fixes #1633
  • Loading branch information
markstory committed Apr 3, 2011
1 parent 0d76724 commit a0321a7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cake/libs/class_registry.php
Expand Up @@ -71,27 +71,28 @@ function &getInstance() {
}

/**
* Loads a class, registers the object in the registry and returns instance of the object.
* Loads a class, registers the object in the registry and returns instance of the object. ClassRegistry::init()
* is used as a factory for models, and handle correct injecting of settings, that assist in testing.
*
* Examples
* Simple Use: Get a Post model instance ```ClassRegistry::init('Post');```
*
* Exapanded: ```array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'TypeOfClass');```
* Exapanded: ```array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'Model');```
*
* 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')
* array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'Model'),
* array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'Model'),
* array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'Model')
* );
* }}}
* @param mixed $class as a string or a single key => value array instance will be created,
* stored in the registry and returned.
* @param string $type TypeOfClass
* @param string $type Only model is accepted as a valid value for $type.
* @return object instance of ClassName
* @access public
* @static
Expand Down

0 comments on commit a0321a7

Please sign in to comment.