Public Member Functions | |
__construct ($strGroup) | |
add ($strIdentifier, array $arrData) | |
delete ($strIdentifier) | |
exists ($strIdentifier) | |
get ($strIdentifier) | |
getAll () | |
setValidator ($cloValidator) | |
Private Attributes | |
$strGroup = null | |
Static Private Attributes | |
static | $arrDataObjects = array() |
static | $arrValidatorList = array() |
The DataObjectPool is a class to manage the DataObjects for different types.
DataObjects are stored within groups. Every group has a validatator, with is applyed to every DataObject stored in the group. If no validatator is set, no validation will be done.
A DataObject is referenced by an identifier, which is uniqiue within a group.
when creating a DataObjectPool instance, the wanted group is set. All following operations are done at this group.
Definition at line 23 of file DataObjectPool.class.php.
DDDBL\DataObjectPool::__construct | ( | $strGroup | ) |
$strGroup | - the group of DataObjects to operate on |
UnexpectedParameterTypeException | - if given group is not a string |
create an instance of DataObjectPool and store the group to operate on
Definition at line 56 of file DataObjectPool.class.php.
DDDBL\DataObjectPool::add | ( | $strIdentifier, | |
array | $arrData | ||
) |
$strIdentifier | - the unique identifier of the DataObject |
$arrData | - the data to store in the DataObject |
UnexpectedParameterTypeException | - if identifier is not a string |
\Exception | - if given identifier is not unique |
create a new DataObject and store it in the pool. The given identifier is the key to retrieve the DataObject from the pool. The given data are stored within the DataObject.
After creation and storage of the DataObject, a reference to the object is returned
Definition at line 110 of file DataObjectPool.class.php.
DDDBL\DataObjectPool::delete | ( | $strIdentifier | ) |
$strIdentifier | - the identifier of the object to delete |
UnexpectedParameterTypeException | - if given identifier is not a string |
\Exception | - if the given identifier is not known |
delete the stored DataObject from the DataObjectPool
Definition at line 135 of file DataObjectPool.class.php.
DDDBL\DataObjectPool::exists | ( | $strIdentifier | ) |
$strIdentifier | - the identifier to check |
UnexpectedParameterTypeException | - if given identifier is not a string |
Definition at line 156 of file DataObjectPool.class.php.
DDDBL\DataObjectPool::get | ( | $strIdentifier | ) |
$strIdentifier | - the identifier of the DataObject to retrieve |
UnexpectedParameterTypeException | - if given identifier is not a string |
\Exception | - if given identifier is unknown |
returns a reference to the DataObject stored under the identifer
Definition at line 179 of file DataObjectPool.class.php.
DDDBL\DataObjectPool::getAll | ( | ) |
returns an array of all stored DataObjects of the active group with the following structure:
array([identifier] => DataObject-reference, [identifier-n] => DataObject-reference-n, [..])
Definition at line 201 of file DataObjectPool.class.php.
DDDBL\DataObjectPool::setValidator | ( | $cloValidator | ) |
$cloValidator | - the validator to set for the group |
UnexpectedParameterTypeException | - if given validator is not a callable |
set the validator for the active group. this validator is given to each newly created DataObject. if it is changed, the existing DataObjects are NOT revalidated.
Definition at line 82 of file DataObjectPool.class.php.
|
staticprivate |
list of DataObjects. stored in the following structure: array([group][uniqueue-identifier] => DataObject-reference, [group-n][uniqueue-identifier-n] => DataObject-reference-n, [..])
Definition at line 45 of file DataObjectPool.class.php.
|
staticprivate |
list of validators for each group. structure: array([group] => validator-callback, [group-n] => validator-callback-n, [..])
Definition at line 37 of file DataObjectPool.class.php.
|
private |
the actual group to operate on
Definition at line 29 of file DataObjectPool.class.php.