DocumentValidator
extends Validator
in package
Validate the document values. <br> Used for avoid client errors when creating or updating documents on collections.
Tags
Table of Contents
Methods
- __construct() : mixed
- Validator constructor.
- getAttributes() : array<string|int, mixed>
- Return document data
- getDescriptorsAttributes() : array<string|int, mixed>
- Return document descriptors attributes.
- hasDescriptors() : bool
- Check if this document validator has document descriptors.
- rules() : array<string|int, mixed>
- Rules for validation.
- setAttributes() : mixed
- Set the data for validation
- validate() : true
- Validate document data.
Methods
__construct()
Validator constructor.
public
__construct([array<string|int, mixed> $data = [] ]) : mixed
Parameters
- $data : array<string|int, mixed> = []
-
Attributes to validate.
getAttributes()
Return document data
public
getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getDescriptorsAttributes()
Return document descriptors attributes.
public
getDescriptorsAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>hasDescriptors()
Check if this document validator has document descriptors.
public
hasDescriptors() : bool
Return values
bool —Returns true if has some descriptor, false otherwise.
rules()
Rules for validation.
public
rules() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>setAttributes()
Set the data for validation
public
setAttributes(array<string|int, mixed> $attributes) : mixed
Parameters
- $attributes : array<string|int, mixed>
-
Attributes to validate.
validate()
Validate document data.
public
validate() : true
Tags
Return values
true —if validation is successful, throw an exception otherwise.