class RequestValidator (View source)

Validates controller request data against Symfony constraints.

Holds the constraint set for the request so controllers can declare rules once and validate repeatedly; extra and missing fields are tolerated to match the permissive form handling of the web UI.

Methods

__construct()

No description

void
setConstraints(array $constraints)

Sets validation constraints for the request data.

void
setRules(array $rules)

Sets validation rules for the request data.

ConstraintViolationListInterface
validate(array $data)

Validates data and returns constraint violations.

string|null
firstErrorMessage(array $data)

Message of the first violation, or null when the data is valid.

Details

__construct()

No description

void setConstraints(array $constraints)

Sets validation constraints for the request data.

Parameters

array $constraints

The validation constraints.

Return Value

void

void setRules(array $rules)

Sets validation rules for the request data.

Parameters

array $rules

The validation rules.

Return Value

void

ConstraintViolationListInterface validate(array $data)

Validates data and returns constraint violations.

Parameters

array $data

The data to validate.

Return Value

ConstraintViolationListInterface

string|null firstErrorMessage(array $data)

Message of the first violation, or null when the data is valid.

Parameters

array $data

Return Value

string|null