Menu

## DocumentValidator extends Validator
in package

DocumentValidator.php : 17

Validate the document values. <br> Used for avoid client errors when creating or updating documents on collections.

##### Tags

author

  Lucas S. Vieira

### 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.php : 44

Validator constructor.

`public __construct([array<string|int, mixed> $data = [] ]) : mixed`

##### Parameters

$data : array<string|int, mixed> = []

  Attributes to validate.

#### getAttributes()

DocumentValidator.php : 39

Return document data

`public getAttributes() : array<string|int, mixed>`

##### Return values

array<string|int, mixed>

#### getDescriptorsAttributes()

DocumentValidator.php : 61

Return document descriptors attributes.

`public getDescriptorsAttributes() : array<string|int, mixed>`

##### Return values

array<string|int, mixed>

#### hasDescriptors()

DocumentValidator.php : 51

Check if this document validator has document descriptors.

`public hasDescriptors() : bool`

##### Return values

bool —

Returns true if has some descriptor, false otherwise.

#### rules()

DocumentValidator.php : 76

Rules for validation.

`public rules() : array<string|int, mixed>`

##### Tags

codeCoverageIgnore

##### Return values

array<string|int, mixed>

#### setAttributes()

DocumentValidator.php : 24

Set the data for validation

`public setAttributes(array<string|int, mixed> $attributes) : mixed`

##### Parameters

$attributes : array<string|int, mixed>

  Attributes to validate.

#### validate()

DocumentValidator.php : 88

Validate document data.

`public validate() : true`

##### Tags

throws
  InvalidParameterException

##### Return values

true —

if validation is successful, throw an exception otherwise.

## Search results