function EntityContentBase::import

Same name in other branches
  1. 8.9.x core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php \Drupal\migrate\Plugin\migrate\destination\EntityContentBase::import()
  2. 10 core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php \Drupal\migrate\Plugin\migrate\destination\EntityContentBase::import()
  3. 11.x 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 169

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.