Registry.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Registry
- Version
- $Id: Registry.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_Registry
Generic storage class helps to manage global data.
- Parent(s)
- \ArrayObject
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties


\Zend_Registry $_registry = null
Registry object provides storage for shared objects.
null
Details- Type
- \Zend_Registry
Methods


__construct(array $array = array(), integer $flags = parent::ARRAY_AS_PROPS) : void
Constructs a parent ArrayObject with default ARRAY_AS_PROPS to allow acces as an object
Name | Type | Description |
---|---|---|
$array | array | data array |
$flags | integer | ArrayObject flags |


_unsetInstance() : void
Unset the default registry instance.
Primarily used in tearDown() in unit tests.
- Returns
- void


get(string $index) : mixed
getter method, basically same as offsetGet().
This method can be called from an object of type Zend_Registry, or it can be called statically. In the latter case, it uses the default static instance stored in the class.
Name | Type | Description |
---|---|---|
$index | string |
|
Type | Description |
---|---|
mixed |
Exception | Description |
---|---|
\Zend_Exception | if no entry is registerd for $index. |


getInstance() : \Zend_Registry
Retrieves the default registry instance.
Type | Description |
---|---|
\Zend_Registry |


isRegistered(string $index) : boolean
Returns TRUE if the $index is a named value in the registry, or FALSE if $index was not found in the registry.
Name | Type | Description |
---|---|---|
$index | string |
Type | Description |
---|---|
boolean |


offsetExists(string $index) : void
Name | Type | Description |
---|---|---|
$index | string |
- Returns
- mixed Workaround for http://bugs.php.net/bug.php?id=40442 (ZF-960).


set(string $index, mixed $value) : void
setter method, basically same as offsetSet().
This method can be called from an object of type Zend_Registry, or it can be called statically. In the latter case, it uses the default static instance stored in the class.
Name | Type | Description |
---|---|---|
$index | string | The location in the ArrayObject in which to store the value. |
$value | mixed | The object to store in the ArrayObject. |


setClassName(string $registryClassName = 'Zend_Registry') : void
Set the class name to use for the default registry instance.
Does not affect the currently initialized instance, it only applies for the next time you instantiate.
Name | Type | Description |
---|---|---|
$registryClassName | string |
Exception | Description |
---|---|
\Zend_Exception | if the registry is initialized or if the class name is not valid. |


setInstance(\Zend_Registry $registry) : void
Set the default registry instance to a specified instance.
Name | Type | Description |
---|---|---|
$registry | \Zend_Registry | An object instance of type Zend_Registry, or a subclass. |
Exception | Description |
---|---|
\Zend_Exception | if registry is already initialized. |