Overview

Namespaces

  • CRUDlex

Classes

  • CRUDControllerProvider
  • CRUDData
  • CRUDEntity
  • CRUDEntityDefinition
  • CRUDMySQLData
  • CRUDMySQLDataFactory
  • CRUDServiceProvider
  • CRUDSimpleFilesystemFileProcessor

Interfaces

  • CRUDDataFactoryInterface
  • CRUDFileProcessorInterface
  • Overview
  • Namespace
  • Class

Class CRUDEntity

Represents a single set of data in field value pairs like the row in a database. Depends of course on the CRUDlex\CRUDData implementation being used. With this objects, the data is passed arround and validated.

Namespace: CRUDlex
Located at CRUDEntity.php
Methods summary
public
# __construct( CRUDlex\CRUDEntityDefinition $definition )

Constructor.

Constructor.

Parameters

$definition
the definition how this entity looks
public
# set( string $field, mixed $value )

Sets a field value pair of this entity.

Sets a field value pair of this entity.

Parameters

$field
the field
$value
the value
public mixed
# get( string $field )

Gets the value of a field.

Gets the value of a field.

Parameters

$field
the field

Returns

mixed

null on invalid field, an int if the definition says that the type of the field is an int, a boolean if the field is a bool or else the raw value

public CRUDlex\CRUDEntityDefinition
# getDefinition( )

Gets the entity definition.

Gets the entity definition.

Returns

CRUDlex\CRUDEntityDefinition
the definition
public array
# validate( CRUDlex\CRUDData $data )

Validates the entity against the definition.

Validates the entity against the definition.

Parameters

$data
the data access instance used for counting things

Returns

array

an array with the fields "valid" and "errors"; valid provides a quick check whether the given entity passes the validation and errors is an array with all fields as keys and arrays as values; this field arrays contain three keys: required, unique and input; each of them represents with a boolean whether the input is ok in that way; if "required" is true, the field wasn't set, unique means the uniqueness of the field in the datasource and input is used to indicate whether the form of the value is correct (a valid int, date, depending on the type in the definition)

Properties summary
protected $definition

The CRUDlex\CRUDEntityDefinition defining how this entity looks like.

The CRUDlex\CRUDEntityDefinition defining how this entity looks like.

#
protected array $entity

Holds the key value data of the entity.

Holds the key value data of the entity.

# array()
CRUDlex API API documentation generated by ApiGen