summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/migrate/src/Plugin/MigrateValidatableEntityInterface.php
blob: baf0cdfcffda87a179f97b15e2b878ec8d8e05c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php

namespace Drupal\migrate\Plugin;

use Drupal\Core\Entity\FieldableEntityInterface;

/**
 * To implement by a destination plugin that should provide entity validation.
 *
 * @ingroup migration
 */
interface MigrateValidatableEntityInterface {

  /**
   * Returns a state of whether an entity needs to be validated before saving.
   *
   * @param \Drupal\Core\Entity\FieldableEntityInterface $entity
   *   The entity to check for required validation.
   *
   * @return bool
   *   A state of whether an entity needs to be validated.
   */
  public function isEntityValidationRequired(FieldableEntityInterface $entity);

  /**
   * Validates the entity.
   *
   * @param \Drupal\Core\Entity\FieldableEntityInterface $entity
   *   The entity to validate.
   *
   * @throws \Drupal\migrate\Exception\EntityValidationException
   *   When the validation didn't succeed.
   */
  public function validateEntity(FieldableEntityInterface $entity);

}