You are here

public function EntityConstraintViolationList::getEntityViolations in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php \Drupal\Core\Entity\EntityConstraintViolationList::getEntityViolations()

Gets violations flagged on entity level, not associated with any field.

Return value

\Drupal\Core\Entity\EntityConstraintViolationListInterface A list of violations on the entity level.

Overrides EntityConstraintViolationListInterface::getEntityViolations

File

core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php, line 87
Contains \Drupal\Core\Entity\EntityConstraintViolationList.

Class

EntityConstraintViolationList
Implements an entity constraint violation list.

Namespace

Drupal\Core\Entity

Code

public function getEntityViolations() {
  $this
    ->groupViolationOffsets();
  $violations = [];
  foreach ($this->entityViolationOffsets as $offset) {
    $violations[] = $this
      ->get($offset);
  }
  return new static($this->entity, $violations);
}