eZPublishCommunityProject  2012.12
eZ\Publish\Core\FieldType\Validator Class Reference

Base field type validator validator. More...

+ Inheritance diagram for eZ\Publish\Core\FieldType\Validator:

Public Member Functions

 __get ($name)
 Magic getter. More...
 
 __set ($name, $value)
 Magic setter. More...
 
 getConstraintsSchema ()
 Returns a schema for supported validator configurations. More...
 
 getMessage ()
 Returns array of messages on performed validations. More...
 
 initializeWithConstraints (array $constraints)
 Initialized an instance of Validator, with earlier configured constraints. More...
 
 validate (Value $value)
 Perform validation on $value. More...
 
 validateConstraints ($constraints)
 

Protected Attributes

 $constraints = array()
 
 $constraintsSchema = array()
 
 $errors = array()
 

Detailed Description

Base field type validator validator.

Member Function Documentation

eZ\Publish\Core\FieldType\Validator::__get (   $name)

Magic getter.

Returns constraint value, from its $name

Parameters
string$name
Exceptions
\eZ\Publish\API\Repository\Exceptions\PropertyNotFoundException
Returns
mixed
eZ\Publish\Core\FieldType\Validator::__set (   $name,
  $value 
)

Magic setter.

Sets $value to constraint, identified by $name

Parameters
string$name
mixed$value
Exceptions
\eZ\Publish\API\Repository\Exceptions\PropertyNotFoundException
eZ\Publish\Core\FieldType\Validator::getConstraintsSchema ( )

Returns a schema for supported validator configurations.

This implementation returns a three dimensional map containing for each validator configuration referenced by identifier a map of supported parameters which are defined by a type and a default value (see example). Example: array( 'stringLength' => array( 'minStringLength' => array( 'type' => 'int', 'default' => 0, ), 'maxStringLength' => array( 'type' => 'int' 'default' => null, ) ), ); The validator identifier.

eZ\Publish\Core\FieldType\Validator::getMessage ( )

Returns array of messages on performed validations.

When no validation errors occurred, the returned array should be empty.

Returns
[]
eZ\Publish\Core\FieldType\Validator::initializeWithConstraints ( array  $constraints)

Initialized an instance of Validator, with earlier configured constraints.

Exceptions
\eZ\Publish\API\Repository\Exceptions\PropertyNotFoundException
Parameters
array$constraints
Returns
void
eZ\Publish\Core\FieldType\Validator::validate ( Value  $value)
abstract

Perform validation on $value.

Will return true when all constraints are matched. If one or more constraints fail, the method will return false.

When a check against a constraint has failed, an entry will be added to the $errors array.

Parameters
\eZ\Publish\Core\FieldType\Value$value
Returns
boolean
eZ\Publish\Core\FieldType\Validator::validateConstraints (   $constraints)
abstract
Parameters
mixed$constraints
Returns
mixed

Member Data Documentation

eZ\Publish\Core\FieldType\Validator::$constraints = array()
protected
eZ\Publish\Core\FieldType\Validator::$constraintsSchema = array()
protected
eZ\Publish\Core\FieldType\Validator::$errors = array()
protected

The documentation for this class was generated from the following file: