You are here

public function EntityContentBase::import in Drupal 10

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

Throws

\Drupal\migrate\MigrateException When an entity cannot be looked up.

\Drupal\migrate\Exception\EntityValidationException When an entity validation hasn't been passed.

Overrides MigrateDestinationInterface::import

2 calls to EntityContentBase::import()
EntityComment::import in core/modules/comment/src/Plugin/migrate/destination/EntityComment.php
Import the row.
EntityUser::import in core/modules/user/src/Plugin/migrate/destination/EntityUser.php
2 methods override EntityContentBase::import()
EntityComment::import in core/modules/comment/src/Plugin/migrate/destination/EntityComment.php
Import the row.
EntityUser::import in core/modules/user/src/Plugin/migrate/destination/EntityUser.php

File

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

Class

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

Namespace

Drupal\migrate\Plugin\migrate\destination

Code

public function import(Row $row, array $old_destination_id_values = []) {
  $this->rollbackAction = MigrateIdMapInterface::ROLLBACK_DELETE;
  $entity = $this
    ->getEntity($row, $old_destination_id_values);
  if (!$entity) {
    throw new MigrateException('Unable to get entity');
  }
  assert($entity instanceof ContentEntityInterface);
  if ($this
    ->isEntityValidationRequired($entity)) {
    $this
      ->validateEntity($entity);
  }
  $ids = $this
    ->save($entity, $old_destination_id_values);
  if ($this
    ->isTranslationDestination()) {
    $ids[] = $entity
      ->language()
      ->getId();
  }
  return $ids;
}