Property | Type | Description | |
---|---|---|---|
$constraints | array | Key is the constraint name, value is the default value.
If no default value is needed, just set to false.
Example:
With no default value
protected $constraints = array(
"maxStringLength" => false
);
With a default value
protected $constraints = array(
"minIntegerValue" => 0,
"maxIntegerValue" => 40
);
|
|
$constraintsSchema | mixed | A one dimensional map with validator parameters. | |
$errors | eZ\Publish\SPI\FieldType\ValidationError[] | The errors collected during validation. |
Method | Description | |
---|---|---|
__get ( string $name ) : mixed | Magic getter. | |
__set ( string $name, mixed $value ) | Magic setter. | |
getConstraintsSchema ( ) | Returns a schema for supported validator configurations. | |
getMessage ( ) : eZ\Publish\SPI\FieldType\ValidationError[] | Returns array of messages on performed validations. | |
initializeWithConstraints ( array $constraints ) | Initialized an instance of Validator, with earlier configured constraints. | |
validate ( |
Perform validation on $value. | |
validateConstraints ( mixed $constraints ) : mixed |
array(
'stringLength' => array(
'minStringLength' => array(
'type' => 'int',
'default' => 0,
),
'maxStringLength' => array(
'type' => 'int'
'default' => null,
)
),
);
The validator identifier. public getConstraintsSchema ( ) |
public getMessage ( ) : eZ\Publish\SPI\FieldType\ValidationError[] | ||
return | eZ\Publish\SPI\FieldType\ValidationError[] |
public initializeWithConstraints ( array $constraints ) | ||
$constraints | array |
abstract public validateConstraints ( mixed $constraints ) : mixed | ||
$constraints | mixed | |
return | mixed |
With no default value
protected $constraints = array(
"maxStringLength" => false
);
With a default value
protected $constraints = array(
"minIntegerValue" => 0,
"maxIntegerValue" => 40
);
protected array $constraints | ||
return | array |
protected mixed $constraintsSchema | ||
return | mixed |