This class is the ancestor of classes that define objects that handle structured data and
that are persistent.
The class extends {@link ArrayObject} by treating the inherited array as the
persistent store and all other data members as run-time data. The convention is that
items stored in the array part of the object are called offsets and are
considered persistent, while all other data members are called members
and are considered run-time data.
This class implements a framework that governs tha management of the object's persistent
data. No offset may hold the NULL value, setting an offset with NULL
value is equivalent to deleting the offset.
Retrieving non-existant offsets will not generate a warning, but only return
NULL.
The class features a series of methods that derived classes may use to customise the
behaviour of the offset management methods:
{@link preOffsetExists()}: This method is called before the
{@link offsetExists()} method with the offset passed as a reference parameter, the
method can be used to change the value of the offset or to provide a custom result:
if the method returns NULL, {@link offsetExists()} will be called; if the
method returns any other type of value, this will be returned and
{@link offsetExists()} will be skipped.
{@link preOffsetGet()}: This is called before the
{@link offsetGet()} method with the offset passed as a reference parameter, the
method can be used to change the value of the offset or to provide a custom result:
if the method returns NULL, {@link offsetGet()} will be called; if the
method returns any other type of value, this will be returned and
{@link offsetGet()} will be skipped.
{@link preOffsetSet()}: This is called before the
{@link offsetSet()} method with the offset and value passed as reference parameters,
the method can be used to change the offset or the value: if the method returns
NULL, {@link offsetSet()} will be called; if the method returns any other
type of value, the {@link offsetSet()} will be skipped.
{@link postOffsetSet()}: This is called after the
{@link offsetSet()} method with the offset and value passed as reference parameters,
the method can be used to set status or statistical variables, it will only be
called if the {@link offsetSet()} method was called.
{@link preOffsetUnset()}: This is called before the
{@link offsetUnset()} method with the offset passed as a reference parameter, the
method can be used to change the offset: if the method returns NULL,
{@link offsetUnset()} will be called; if the method returns any other type of value,
the {@link offsetUnset()} will be skipped.
{@link postOffsetUnset()}: This is called after the
{@link offsetUnset()} method with the offset passed as a reference parameter, the
method can be used to set status or statistical variables, it will only be called if
the {@link offsetUnset()} method was called.
The class features a series of methods that are useful for handling the persistent data
as a whole:
{@link arrayKeys()}: This method is the equivalent of the
{@link array_keys()} function.
{@link arrayValues()}: This method is the equivalent of the
{@link array_values()} function.
The class features a static method, {@link Object2Array}, that can be used to
convert a structure of nested {@link ArrayObject} instances into a nested array, this
will be useful when normalising objects before persisting.
This class uses the {@link Accessors} trait to provide a common framework to methods that
manage data properties and offsets.
This method can be used to obtain an array of arrays from a nested structure.
The method expects as the first parameter a reference to an {@link ArrayObject} or to
an array, it will convert the provided parameter to an array and traverse it,
converting recursively any {@link ArrayObject} instance into an array.
This method can be used to manage the offset before passing it to the inherited
{@link ArrayObject::OffsetExists()} method.
The method provides the offset as a reference, if the method returns NULL
it means that the offset must be passed to the inherited
{@link ArrayObject::OffsetExists()}; if the method returns any other value, this will
be returned and the inherited {@link ArrayObject::OffsetExists()} will be skipped.
This method can be used to manage the offset before passing it to the inherited
{@link ArrayObject::OffsetGet()} method.
The method provides the offset as a reference, if the method returns NULL
it means that the offset must be passed to the inherited
{@link ArrayObject::OffsetGet()}; if the method returns any other value, this must be
returned and the inherited {@link ArrayObject::OffsetGet()} skipped.
This method can be used to manage the offset before passing it to the inherited
{@link ArrayObject::OffsetSet()} method.
The method provides the offset and value as references, if the method returns
NULL it means that the offset and value must be passed to the inherited
{@link ArrayObject::OffsetSet()}; if the method returns any other value, this means
that the inherited {@link ArrayObject::OffsetSet()} should be skipped.
This method can be used to manage the offset before passing it to the inherited
{@link ArrayObject::OffsetUnset()} method.
The method provides the offset as reference, if the method returns NULL it
means that the offset and value must be passed to the inherited
{@link ArrayObject::OffsetUnset()}; if the method returns any other value, this means
that the inherited {@link ArrayObject::OffsetUnset()} should be skipped.