You are here

protected function MigrationBase::dependenciesComplete in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 includes/base.inc \MigrationBase::dependenciesComplete()

Reports whether all (hard) dependencies have completed migration

2 calls to MigrationBase::dependenciesComplete()
MigrationBase::processImport in includes/base.inc
Perform an operation during the import phase
MigrationBase::processRollback in includes/base.inc
Perform an operation during the rollback phase.

File

includes/base.inc, line 906
Defines the base class for migration processes.

Class

MigrationBase
The base class for all objects representing distinct steps in a migration process. Most commonly these will be Migration objects which actually import data from a source into a Drupal destination, but by deriving classes directly from MigrationBase…

Code

protected function dependenciesComplete($rollback = FALSE) {
  if ($rollback) {
    foreach (migrate_migrations() as $migration) {
      $dependencies = $migration
        ->getHardDependencies();
      if (array_search($this->machineName, $dependencies) !== FALSE) {
        if (method_exists($migration, 'importedCount') && $migration
          ->importedCount() > 0) {
          return FALSE;
        }
      }
    }
  }
  else {
    foreach ($this->dependencies as $dependency) {
      $migration = MigrationBase::getInstance($dependency);
      if (!$migration || !$migration
        ->isComplete()) {
        return FALSE;
      }
    }
  }
  return TRUE;
}