You are here

function drush_migrate_fields_destination in Migrate 6.2

Same name and namespace in other branches
  1. 7.2 migrate.drush.inc \drush_migrate_fields_destination()

File

./migrate.drush.inc, line 375
Drush support for the migrate module

Code

function drush_migrate_fields_destination($args = NULL) {
  try {
    $migrations = drush_migrate_get_migrations($args);
    foreach ($migrations as $name => $migration) {
      drush_print("\n" . dt('@migration Destination Fields', array(
        '@migration' => $name,
      )) . "\n");
      $destination = $migration
        ->getDestination();
      if (method_exists($destination, 'fields')) {
        $table = array();
        foreach ($destination
          ->fields($migration) as $machine_name => $description) {
          $table[] = array(
            $description,
            $machine_name,
          );
        }
        drush_print_table($table);
      }
      else {
        drush_print(dt('No fields were found.'));
      }
    }
  } catch (MigrateException $e) {
    drush_print($e
      ->getMessage());
    exit;
  }
}