EntityConstraintViolationListInterface
interface EntityConstraintViolationListInterface implements ConstraintViolationListInterface (View source)
Interface for the result of entity validation.
The Symfony violation list is extended with methods that allow filtering violations by fields and field access. Forms leverage that to skip possibly pre-existing violations that cannot be caused or fixed by the form.
Methods
Gets violations flagged on entity level, not associated with any field.
Gets the violations of the given field.
Gets the violations of the given fields.
Filters this violation list by the given fields.
Filters this violation list to apply for accessible fields only.
Returns the names of all violated fields.
The entity which has been validated.
Details
EntityConstraintViolationListInterface
getEntityViolations()
Gets violations flagged on entity level, not associated with any field.
ConstraintViolationListInterface
getByField(string $field_name)
Gets the violations of the given field.
EntityConstraintViolationListInterface
getByFields(array $field_names)
Gets the violations of the given fields.
When violations should be displayed for a sub-set of visible fields only, this method may be used to filter the set of visible violations first.
$this
filterByFields(array $field_names)
Filters this violation list by the given fields.
The returned object just has violations attached to the provided fields.
When violations should be displayed for a sub-set of visible fields only, this method may be used to filter the set of visible violations first.
$this
filterByFieldAccess(AccountInterface $account = NULL)
Filters this violation list to apply for accessible fields only.
Violations for inaccessible fields are removed so the returned object just has the remaining violations.
string[]
getFieldNames()
Returns the names of all violated fields.
FieldableEntityInterface
getEntity()
The entity which has been validated.