trait EntityResourceValidationTrait (View source)

internal  
 

Consider making public in https://www.drupal.org/node/2300677

Methods

validate(EntityInterface $entity, array $fields_to_validate = [])

Verifies that an entity does not violate any validation constraints.

Details

protected validate(EntityInterface $entity, array $fields_to_validate = [])

Verifies that an entity does not violate any validation constraints.

The validation errors will be filtered to not include fields to which the current user does not have access and if $fields_to_validate is provided will only include fields in that array.

Parameters

EntityInterface $entity

The entity to validate.

array $fields_to_validate

(optional) An array of field names. If specified, filters the violations list to include only this set of fields.

Exceptions

UnprocessableEntityHttpException