You are here

public static function MigrateGroup::getInstance in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 includes/group.inc \MigrateGroup::getInstance()

Retrieve (creating if necessary) an instance of the named group.

Parameters

string $name: Group name.

array $dependencies: List of dependent groups.

3 calls to MigrateGroup::getInstance()
migrate_ui_migrate_group in migrate_ui/migrate_ui.pages.inc
Menu callback
migrate_ui_migrate_group_title in migrate_ui/migrate_ui.module
Title callback for the migrate group view page.
MigrationBase::__construct in includes/base.inc
Construction of a MigrationBase instance.

File

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

Class

MigrateGroup
@file Definition for a migration group.

Code

public static function getInstance($name, $dependencies = array()) {
  if (empty(self::$groupList[$name])) {
    $row = db_select('migrate_group', 'mg')
      ->fields('mg')
      ->condition('name', $name)
      ->execute()
      ->fetchObject();
    if ($row) {
      $arguments = unserialize($row->arguments);
      $arguments = MigrationBase::decryptArguments($arguments);
      if (empty($dependencies) && isset($arguments['dependencies'])) {
        $dependencies = $arguments['dependencies'];
      }
      self::$groupList[$name] = new MigrateGroup($name, $dependencies, $row->title, $arguments);
    }
    else {
      self::register($name);
      self::$groupList[$name] = new MigrateGroup($name, $dependencies);
    }
  }
  return self::$groupList[$name];
}