Overview

Namespaces

  • CRUDlex

Classes

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

Interfaces

  • CRUDDataFactoryInterface
  • CRUDFileProcessorInterface
  • Overview
  • Namespace
  • Class

Class CRUDEntityValidator

Performs validation of the field values of the given CRUDlex\CRUDEntity.

Namespace: CRUDlex
Located at CRUDEntityValidator.php
Methods summary
protected
# validateRequired( string $field, array & $fieldErrors, boolean & $valid )

Validates the given field for the required constraint.

Validates the given field for the required constraint.

Parameters

$field
the field to validate
$fieldErrors

$fieldErrors the error collecting array

$valid

$valid the validation flag

protected
# validateUnique( string $field, CRUDlex\CRUDData $data, array & $fieldErrors, boolean & $valid )

Validates the given field for the unique constraint.

Validates the given field for the unique constraint.

Parameters

$field
the field to validate
$data
the data instance to work with
$fieldErrors

$fieldErrors the error collecting array

$valid

$valid the validation flag

protected
# validateSet( string $field, array & $fieldErrors, boolean & $valid )

Validates the given field for the set type.

Validates the given field for the set type.

Parameters

$field
the field to validate
$fieldErrors

$fieldErrors the error collecting array

$valid

$valid the validation flag

protected
# validateNumber( string $field, string $numberType, array & $fieldErrors, boolean & $valid )

Validates the given field for a number type.

Validates the given field for a number type.

Parameters

$field
the field to validate
$numberType
the type, might be 'int' or 'float'
$fieldErrors

$fieldErrors the error collecting array

$valid

$valid the validation flag

protected
# validateDate( string $field, array & $fieldErrors, boolean & $valid )

Validates the given field for the date type.

Validates the given field for the date type.

Parameters

$field
the field to validate
$fieldErrors

$fieldErrors the error collecting array

$valid

$valid the validation flag

protected
# validateDateTime( string $field, array & $fieldErrors, boolean & $valid )

Validates the given field for the datetime type.

Validates the given field for the datetime type.

Parameters

$field
the field to validate
$fieldErrors

$fieldErrors the error collecting array

$valid

$valid the validation flag

protected
# validateReference( string $field, CRUDlex\CRUDData $data, array & $fieldErrors, boolean & $valid )

Validates the given field for the reference type.

Validates the given field for the reference type.

Parameters

$field
the field to validate
$data
the data instance to work with
$fieldErrors

$fieldErrors the error collecting array

$valid

$valid the validation flag

public
# __construct( CRUDlex\CRUDEntity $entity )

Constructor.

Constructor.

Parameters

$entity
the entity to validate
public array
# validate( CRUDlex\CRUDData $data, integer $expectedVersion )

Validates the entity against the definition.

Validates the entity against the definition.

Parameters

$data
the data access instance used for counting things
$expectedVersion
the version to perform the optimistic locking check on

Returns

array

an array with the fields "valid" and "fields"; valid provides a quick check whether the given entity passes the validation and fields 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 $entity

The entity to validate.

The entity to validate.

#
protected $definition

The entities definition.

The entities definition.

#
CRUDlex API API documentation generated by ApiGen