trait EntityValidationTrait (View source)

internal  JSON:API maintains no PHP API. The API is the HTTP API. This class may change at any time and could break any dependencies on it.
 

Provides a method to validate an entity.

Methods

static 
validate(EntityInterface $entity, array $field_names = NULL)

Verifies that an entity does not violate any validation constraints.

Details

static protected validate(EntityInterface $entity, array $field_names = NULL)

Verifies that an entity does not violate any validation constraints.

Parameters

EntityInterface $entity

The entity object.

array $field_names

(optional) An array of field names. If specified, filters the violations list to include only this set of fields. Defaults to NULL, which means that all violations will be reported.

Exceptions

UnprocessableHttpEntityException

See also

EntityResourceValidationTrait::validate