Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MigrationState.php

function MigrationState::buildDeclaredStateBySource

Gets migration data from *.migrate_drupal.yml sorted by source module.

Parameters

string $version: The legacy Drupal version.

1 call to MigrationState::buildDeclaredStateBySource()
MigrationState::buildUpgradeState in core/modules/migrate_drupal/src/MigrationState.php
Determines migration state for each source module enabled on the source.

File

core/modules/migrate_drupal/src/MigrationState.php, line 379

Class

MigrationState
Determines the migrate state for all modules enabled on the source.

Namespace

Drupal\migrate_drupal

Code

protected function buildDeclaredStateBySource($version) {
    $migration_states = $this->getMigrationStates();
    $state_by_source = [];
    $dest_by_source = [];
    $states = [
        static::FINISHED,
        static::NOT_FINISHED,
    ];
    foreach ($migration_states as $info) {
        foreach ($states as $state) {
            if (isset($info[$state][$version])) {
                foreach ($info[$state][$version] as $source => $destination) {
                    // Add the state.
                    $state_by_source[$source][] = $state;
                    // Add the destination modules.
                    $dest_by_source += [
                        $source => [],
                    ];
                    $dest_by_source[$source] = array_merge($dest_by_source[$source], (array) $destination);
                }
            }
        }
    }
    $this->stateBySource[$version] = array_map('array_unique', $state_by_source);
    $this->declaredBySource[$version] = array_map('array_unique', $dest_by_source);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal