You are here

public static function MigrateGroup::groups in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 includes/group.inc \MigrateGroup::groups()
2 calls to MigrateGroup::groups()
drush_migrate_status in ./migrate.drush.inc
A simplified version of the dashboard page.
migrate_migrations in ./migrate.module
Retrieve a list of all active migrations, ordered by dependencies. To be recognized, a class must be non-abstract, and derived from MigrationBase.

File

includes/group.inc, line 62
Definition for a migration group.

Class

MigrateGroup
@file Definition for a migration group.

Code

public static function groups() {
  $groups = array();
  $dependent_groups = array();
  $dependencies_list = array();
  $required_groups = array();
  foreach (self::$groupList as $name => $group) {
    $dependencies = $group
      ->getDependencies();
    $dependencies_list[$name] = $dependencies;
    if (count($dependencies) > 0) {

      // Set groups with dependencies aside for reordering
      $dependent_groups[$name] = $group;
      $required_groups += $dependencies;
    }
    else {

      // No dependencies, just add
      $groups[$name] = $group;
    }
  }
  $ordered_groups = migrate_order_dependencies($dependencies_list);
  foreach ($ordered_groups as $name) {
    if (!isset($groups[$name])) {
      $groups[$name] = $dependent_groups[$name];
    }
  }
  return $groups;
}