Class Collections.
A repository for class objects, each registered with a key. If you try to add an object with the same key twice, nothing will come of it. If you need a second instance of an object, give it another key.
_duplicate( string $alias , string $class )
Checks to see if $alias is a duplicate $class Object
$alias $class boolean_getMap( string $key )
Return the name of a class in the registry.
$key stringaddObject( string $key , object $object )
Add $object to the registry, associating it with the name $key.
$key $object booleanconfig( string $type , array $param array() )
Sets the default constructor parameter for an object type
$type $param optional array() mixedgetInstance( )
Return a singleton instance of the ClassRegistry.
ClassRegistrygetObject( string $key )
Return object which corresponds to given key.
$key mixedinit( string|array $class , boolean $strict false )
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');
Expanded: array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry');
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'), array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry'), array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry') );
$class $strict optional false mixedCakeExceptionisKeySet( string $key )
Returns true if given key is present in the ClassRegistry.
$key booleankeys( )
Get all keys from the registry.
arraymap( string $key , string $name )
Add a key name pair to the registry to map name to class in the registry.
$key $name mapKeys( )
Get all keys from the map in the registry.
arrayremoveObject( string $key )
Remove object which corresponds to given key.
$key
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/2.7/class-ClassRegistry.html