![]() |
TYPO3
7.6
|
Public Member Functions | |
get ($namespace, $key, $defaultValue=null) | |
set ($namespace, $key, $value) | |
remove ($namespace, $key) | |
removeAllByNamespace ($namespace) | |
Protected Member Functions | |
isNamespaceLoaded ($namespace) | |
loadEntriesByNamespace ($namespace) | |
validateNamespace ($namespace) | |
Protected Attributes | |
$entries = array() | |
$loadedNamespaces = array() | |
A class to store and retrieve entries in a registry database table.
The intention is to have a place where we can store things (mainly settings) that should live for more than one request, longer than a session, and that shouldn't expire like it would with a cache. You can actually think of it being like the Windows Registry in some ways.
Credits: Heavily inspired by Drupal's variable_*() functions.
Definition at line 27 of file Registry.php.
get | ( | $namespace, | |
$key, | |||
$defaultValue = null |
|||
) |
Returns a persistent entry.
string | $namespace | Extension key for extensions starting with 'tx_' / 'Tx_' / 'user_' or 'core' for core registry entries |
string | $key | The key of the entry to return. |
mixed | $defaultValue | Optional default value to use if this entry has never been set. Defaults to NULL. |
\InvalidArgumentException | Throws an exception if the given namespace is not valid |
Definition at line 48 of file Registry.php.
References Registry\isNamespaceLoaded(), Registry\loadEntriesByNamespace(), and Registry\validateNamespace().
|
protected |
check if the given namespace is loaded
string | $namespace | Namespace. extension key for extensions or 'core' for core registry entries |
Definition at line 132 of file Registry.php.
Referenced by Registry\get(), and Registry\set().
|
protected |
Loads all entries of the given namespace into the internal $entries cache.
string | $namespace | Namespace. extension key for extensions or 'core' for core registry entries |
\InvalidArgumentException | Throws an exception if the given namespace is not valid |
Definition at line 144 of file Registry.php.
References $GLOBALS, and Registry\validateNamespace().
Referenced by Registry\get(), and Registry\set().
remove | ( | $namespace, | |
$key | |||
) |
Unsets a persistent entry.
string | $namespace | Namespace. extension key for extensions or 'core' for core registry entries |
string | $key | The key of the entry to unset. |
\InvalidArgumentException | Throws an exception if the given namespace is not valid |
Definition at line 104 of file Registry.php.
References $GLOBALS, and Registry\validateNamespace().
removeAllByNamespace | ( | $namespace | ) |
Unsets all persistent entries of the given namespace.
string | $namespace | Namespace. extension key for extensions or 'core' for core registry entries |
\InvalidArgumentException | Throws an exception if the given namespace is not valid |
Definition at line 118 of file Registry.php.
References $GLOBALS, and Registry\validateNamespace().
set | ( | $namespace, | |
$key, | |||
$value | |||
) |
Sets a persistent entry.
This is the main method that can be used to store a key-value. It is name spaced with a unique string. This name space should be chosen from extensions that it is unique. It is advised to use something like 'tx_extensionname'. The prefix 'core' is reserved for the TYPO3 core.
Do not store binary data into the registry, it's not build to do that, instead use the proper way to store binary data: The filesystem.
string | $namespace | Extension key for extensions starting with 'tx_' / 'Tx_' / 'user_' or 'core' for core registry entries. |
string | $key | The key of the entry to set. |
mixed | $value | The value to set. This can be any PHP data type; this class takes care of serialization if necessary. |
\InvalidArgumentException | Throws an exception if the given namespace is not valid |
Definition at line 74 of file Registry.php.
References $GLOBALS, Registry\isNamespaceLoaded(), Registry\loadEntriesByNamespace(), and Registry\validateNamespace().
|
protected |
Checks the given namespace. It must be at least two characters long. The word 'core' is reserved for TYPO3 core usage.
If it does not have a valid format an exception is thrown.
string | $namespace | Namespace |
\InvalidArgumentException | Throws an exception if the given namespace is not valid |
Definition at line 166 of file Registry.php.
Referenced by Registry\get(), Registry\loadEntriesByNamespace(), Registry\remove(), Registry\removeAllByNamespace(), and Registry\set().
|
protected |
Definition at line 32 of file Registry.php.
|
protected |
Definition at line 37 of file Registry.php.