You are here

public function EntityContentBase::validateEntity in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php \Drupal\migrate\Plugin\migrate\destination\EntityContentBase::validateEntity()

Validates the entity.

Parameters

\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity to validate.

Throws

\Drupal\migrate\Exception\EntityValidationException When the validation didn't succeed.

Overrides MigrateValidatableEntityInterface::validateEntity

1 call to EntityContentBase::validateEntity()
EntityContentBase::import in core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php

File

core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php, line 194

Class

EntityContentBase
Provides destination class for all content entities lacking a specific class.

Namespace

Drupal\migrate\Plugin\migrate\destination

Code

public function validateEntity(FieldableEntityInterface $entity) {
  $violations = $entity
    ->validate();
  if (count($violations) > 0) {
    throw new EntityValidationException($violations);
  }
}