function EntityConfigBase::rollback

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

Overrides Entity::rollback

2 calls to EntityConfigBase::rollback()
EntityFieldStorageConfig::rollback in core/modules/migrate/src/Plugin/migrate/destination/EntityFieldStorageConfig.php
Delete the specified destination object from the target Drupal.
EntityViewMode::rollback in core/modules/migrate/src/Plugin/migrate/destination/EntityViewMode.php
Delete the specified destination object from the target Drupal.
2 methods override EntityConfigBase::rollback()
EntityFieldStorageConfig::rollback in core/modules/migrate/src/Plugin/migrate/destination/EntityFieldStorageConfig.php
Delete the specified destination object from the target Drupal.
EntityViewMode::rollback in core/modules/migrate/src/Plugin/migrate/destination/EntityViewMode.php
Delete the specified destination object from the target Drupal.

File

core/modules/migrate/src/Plugin/migrate/destination/EntityConfigBase.php, line 283

Class

EntityConfigBase
Base destination class for importing configuration entities.

Namespace

Drupal\migrate\Plugin\migrate\destination

Code

public function rollback(array $destination_identifier) {
    if ($this->isTranslationDestination()) {
        // The entity id does not include the langcode.
        $id_values = [];
        foreach ($destination_identifier as $key => $value) {
            if ($this->isTranslationDestination() && $key === 'langcode') {
                continue;
            }
            $id_values[] = $value;
        }
        $entity_id = implode('.', $id_values);
        $language = $destination_identifier['langcode'];
        $config = $this->storage
            ->load($entity_id)
            ->getConfigDependencyName();
        $config_override = $this->languageManager
            ->getLanguageConfigOverride($language, $config);
        // Rollback the translation.
        $config_override->delete();
    }
    else {
        $destination_identifier = implode('.', $destination_identifier);
        parent::rollback([
            $destination_identifier,
        ]);
    }
}

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