Skip to content

Commit a0321a7

Browse files
committed
Updating documentation for ClassRegistry::init() to not imply that it
can be used to construct non model objects. Fixes #1633
1 parent 0d76724 commit a0321a7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

cake/libs/class_registry.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,27 +71,28 @@ function &getInstance() {
7171
}
7272

7373
/**
74-
* Loads a class, registers the object in the registry and returns instance of the object.
74+
* Loads a class, registers the object in the registry and returns instance of the object. ClassRegistry::init()
75+
* is used as a factory for models, and handle correct injecting of settings, that assist in testing.
7576
*
7677
* Examples
7778
* Simple Use: Get a Post model instance ```ClassRegistry::init('Post');```
7879
*
79-
* Exapanded: ```array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'TypeOfClass');```
80+
* Exapanded: ```array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'Model');```
8081
*
8182
* Model Classes can accept optional ```array('id' => $id, 'table' => $table, 'ds' => $ds, 'alias' => $alias);```
8283
*
8384
* When $class is a numeric keyed array, multiple class instances will be stored in the registry,
8485
* no instance of the object will be returned
8586
* {{{
8687
* array(
87-
* array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'TypeOfClass'),
88-
* array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'TypeOfClass'),
89-
* array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'TypeOfClass')
88+
* array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'Model'),
89+
* array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'Model'),
90+
* array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'Model')
9091
* );
9192
* }}}
9293
* @param mixed $class as a string or a single key => value array instance will be created,
9394
* stored in the registry and returned.
94-
* @param string $type TypeOfClass
95+
* @param string $type Only model is accepted as a valid value for $type.
9596
* @return object instance of ClassName
9697
* @access public
9798
* @static

0 commit comments

Comments
 (0)