class InvalidEntityException
Same name in other branches
- 10 core/lib/Drupal/Core/DefaultContent/InvalidEntityException.php \Drupal\Core\DefaultContent\InvalidEntityException
Thrown if an entity being imported has validation errors.
@internal This API is experimental.
Hierarchy
- class \Drupal\Core\DefaultContent\InvalidEntityException extends \Drupal\Core\DefaultContent\RuntimeException
Expanded class hierarchy of InvalidEntityException
1 file declares its use of InvalidEntityException
- ContentImportTest.php in core/
tests/ Drupal/ FunctionalTests/ DefaultContent/ ContentImportTest.php
File
-
core/
lib/ Drupal/ Core/ DefaultContent/ InvalidEntityException.php, line 14
Namespace
Drupal\Core\DefaultContentView source
final class InvalidEntityException extends \RuntimeException {
public function __construct(EntityConstraintViolationListInterface $violations, string $filePath) {
$messages = [];
foreach ($violations as $violation) {
assert($violation instanceof ConstraintViolationInterface);
$messages[] = $violation->getPropertyPath() . '=' . $violation->getMessage();
}
// Example: "/path/to/file.yml: field_a=Violation 1., field_b=Violation 2.".
parent::__construct("{$filePath}: " . implode('||', $messages));
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.