function EntityContentBase::save

Same name in other branches
  1. 9 core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php \Drupal\migrate\Plugin\migrate\destination\EntityContentBase::save()
  2. 8.9.x core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php \Drupal\migrate\Plugin\migrate\destination\EntityContentBase::save()
  3. 10 core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php \Drupal\migrate\Plugin\migrate\destination\EntityContentBase::save()

Saves the entity.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The content entity.

array $old_destination_id_values: (optional) An array of destination ID values. Defaults to an empty array.

Return value

array An array containing the entity ID.

3 calls to EntityContentBase::save()
EntityContentBase::import in core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php
EntityContentComplete::save in core/modules/migrate/src/Plugin/migrate/destination/EntityContentComplete.php
EntityUser::save in core/modules/user/src/Plugin/migrate/destination/EntityUser.php
3 methods override EntityContentBase::save()
EntityContentComplete::save in core/modules/migrate/src/Plugin/migrate/destination/EntityContentComplete.php
EntityRevision::save in core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php
EntityUser::save in core/modules/user/src/Plugin/migrate/destination/EntityUser.php

File

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

Class

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

Namespace

Drupal\migrate\Plugin\migrate\destination

Code

protected function save(ContentEntityInterface $entity, array $old_destination_id_values = []) {
    $entity->setSyncing(TRUE);
    $entity->save();
    return [
        $entity->id(),
    ];
}

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