manageElementListOffset()
manageElementListOffset(string $theOffset, string $theTypeOffset, string $theDataOffset, string $theTypeValue, mixed $theDataValue, mixed $theOperation, boolean $getOld) : mixed
<h4>Manage element list offset</h4>
This class provides a protected interface for member accessor methods, both for
properties and offsets, this method can be used to manage the elements of an array of
array elements in which one item's value represents the discriminant and the other
item is a list of values.
Offsets of this kind are arrays that represent a list of elements, each of which is
constituted by an array of two items, where the value matching the
$theTypeOffset key represents the element key and the value matching the
$theDataOffset key represents the element's value. The element's value, in
this case, is a list of values: this method allows managing the individual elements
of this list.
It is assumed that the value at the provided offset is an array, if this is not the
case, the method will raise an exception.
If you want to manage the set itself, you have to use the offset management methods.
The method accepts the following parameters:
- $theOffset: The offset to the attribute containing the match list.
- $theTypeOffset: The offset to the element item representing the
discriminator.
- $theDataOffset: The offset to the element holding the list of values
related to the discriminator.
- $theTypeValue: The value of the discriminator element to match.
- $theDataValue: The value of the list element related to the
discriminator, or the list operation:
- NULL: Select all the elements of the list related to the provided
discriminator.
- other: Any other type will be cast to a string and will represent the
list value to be matched.
- $theOperation: The operation to be performed:
- NULL: Return the list value matched by the $theDataValue
parameter.
- FALSE: Delete the list value matched by the $theDataValue
parameter.
- TRUE: Add the list value provided in the $theDataValue
parameter to the list.
- $getOld: Determines what the method will return:
- TRUE: Return the value before it was eventually modified.
- FALSE: Return the value after it was eventually modified.
The method expects each element to be a structure containing containing both the
$theTypeOffset and $theDataOffset items, if that is not the case,
the method will raise an exception. All elements are supposed to be arrays.
Parameters
string |
$theOffset |
Offset to be managed. |
string |
$theTypeOffset |
Offset of type item. |
string |
$theDataOffset |
Offset of data item. |
string |
$theTypeValue |
Discriminator value. |
mixed |
$theDataValue |
Lis value selector. |
mixed |
$theOperation |
Operation. |
boolean |
$getOld |
TRUE get old value. |
Throws
- \OntologyWrapper\traits\Exception
Returns
mixed
— Old or new value.