Property | Type | Description | |
---|---|---|---|
$definition | The entities definition. | ||
$entity | The entity to validate. |
Method | Description | |
---|---|---|
__construct ( |
Constructor. | |
validate ( |
Validates the entity against the definition. |
Method | Description | |
---|---|---|
buildUpData ( ) : array | Builds up the data to validate from the entity. | |
buildUpRules ( |
Builds up the validation rules for the entity according to its definition. | |
fieldConstraintsToRules ( string $field, |
Builds up the validation rules for a single field according to the entity definition constraints. | |
fieldTypeToRules ( string $field, |
Builds up the validation rules for a single field according to the entity definition type. |
public __construct ( |
||
$entity | the entity to validate |
protected buildUpData ( ) : array | ||
return | array | a map field to raw value |
protected buildUpRules ( |
||
$data | the data instance to use for validation | |
$validator | Valdi\Validator | the validator to use |
return | array | the validation rules for the entity |
protected fieldConstraintsToRules ( string $field, |
||
$field | string | the field for the rules |
$data | the data instance to use for validation | |
return | array | the validation rules for the field |
protected fieldTypeToRules ( string $field, |
||
$field | string | the field for the rules |
$data | the data instance to use for validation | |
$validator | Valdi\Validator | the validator to use |
return | array | the validation rules for the field |
public validate ( |
||
$data | the data access instance used for counting things | |
$expectedVersion | integer | the version to perform the optimistic locking check on |
return | array | an array with the fields "valid" and "errors"; valid provides a quick check whether the given entity passes the validation and errors is an array with all errored fields as keys and arrays as values; this field arrays contains the actual errors on the field: "boolean", "floating", "integer", "dateTime" (for dates and datetime fields), "inSet", "reference", "required", "unique", "value" (only for the version field, set if the optimistic locking failed). |