You are here

public function EntityValidationException::getViolationMessages in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/src/Exception/EntityValidationException.php \Drupal\migrate\Exception\EntityValidationException::getViolationMessages()
  2. 9 core/modules/migrate/src/Exception/EntityValidationException.php \Drupal\migrate\Exception\EntityValidationException::getViolationMessages()

Returns the list of violation messages.

Return value

string[] The list of violation messages.

1 call to EntityValidationException::getViolationMessages()
EntityValidationException::__construct in core/modules/migrate/src/Exception/EntityValidationException.php
EntityValidationException constructor.

File

core/modules/migrate/src/Exception/EntityValidationException.php, line 66

Class

EntityValidationException
To throw when an entity generated during the import is not valid.

Namespace

Drupal\migrate\Exception

Code

public function getViolationMessages() {
  $messages = [];
  foreach ($this->violations as $violation) {
    assert($violation instanceof ConstraintViolationInterface);
    $messages[] = sprintf('%s=%s', $violation
      ->getPropertyPath(), $violation
      ->getMessage());
  }
  return $messages;
}