Documentation

DataObject
in package

A data Object reperesents a Basic data entity. e.g. a Client

In this early stage of development the data fields are take directly from the database, and the DataObjects represents mostly a table or several joined tables, however this will change in some way or the other in future versions.

Tags
uses
DataType

Table of Contents

$data  : array<string|int, DataType>
$dataTypes  : array<string|int, mixed>
This has to be overwritten by the concrete implementation.
$lifeValidate  : bool
__construct()  : mixed
The constructor is normally called from one of the {@link \VeruA\DataMapper\DataMapper}s descendants
__get()  : DataType
Returnes the {@link \VeruA\DataObjects\DataType} of the requested field
__isset()  : mixed
__set()  : mixed
Sets a value instatiating a new DataType Object if none is set, or sets the value of the DataType
__unset()  : mixed
validate()  : bool
Validate the data array with the registered validators
values()  : mixed
Returns the internal data Array, containing all the DataObjects

Properties

$data

protected array<string|int, DataType> $data = []

Contains the DataTypes with their respetive values

$dataTypes

This has to be overwritten by the concrete implementation.

protected array<string|int, mixed> $dataTypes = []

The format of the array is as follws:

column => [ 'type' => DataType, 'props' => ['required' => bool, 'len' => int] ], ...
  • column The column from the database
  • type The DataType to instation for the respective value
  • props are optional and every validator can implement their own
  • Need to be configured in the descendants. This is the actual configuration of the fields DataTypes

    $lifeValidate

    private bool $lifeValidate = false

    If set to true every value is validated on __set()

    Methods

    __construct()

    The constructor is normally called from one of the {@link \VeruA\DataMapper\DataMapper}s descendants

    public __construct([array<string|int, mixed> $data = null ]) : mixed
    Parameters
    $data : array<string|int, mixed> = null

    Sets the values of the DataObject. Every value is passed to the respective

    Return values
    mixed

    __get()

    Returnes the {@link \VeruA\DataObjects\DataType} of the requested field

    public __get(string $name) : DataType
    Parameters
    $name : string

    The name of the field

    Tags
    throws
    OutOfRangeException

    if the field does not exist

    Return values
    DataType

    Returns the DataType of the field

    __isset()

    public __isset(mixed $name) : mixed
    Parameters
    $name : mixed
    Return values
    mixed

    __set()

    Sets a value instatiating a new DataType Object if none is set, or sets the value of the DataType

    public __set(string $name, mixed $value) : mixed
    Parameters
    $name : string

    The name of the field

    $value : mixed

    The value

    Tags
    throws
    OutOfRangeException

    if the field does not exist

    Return values
    mixed

    __unset()

    public __unset(mixed $name) : mixed
    Parameters
    $name : mixed
    Return values
    mixed

    validate()

    Validate the data array with the registered validators

    public validate() : bool
    Tags
    throws
    ValidationException

    if the validation does not pass a validator containing all errors encountered

    Return values
    bool

    Returns true if all fields are valid

    values()

    Returns the internal data Array, containing all the DataObjects

    public values() : mixed
    Return values
    mixed

    Search results