You are here

public function RoleTableMigration::__construct in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 migrate_example/example.table_copy.inc \RoleTableMigration::__construct()

General initialization of a Migration object.

Overrides Migration::__construct

File

migrate_example/example.table_copy.inc, line 11
Make a copy of the role table. To use this you must create a table named role_copy with the same structure as role.

Class

RoleTableMigration
@file Make a copy of the role table. To use this you must create a table named role_copy with the same structure as role.

Code

public function __construct() {
  parent::__construct();
  $this->dependencies = array();
  $this->description = 'Copy the role table as an example of table_copy plugin.';
  $destination_key = array(
    'rid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
    ),
  );
  $query = db_select('role', 'r')
    ->fields('r');
  $this->source = new MigrateSourceSQL($query);
  $this->destination = new MigrateDestinationTableCopy('role_copy', $destination_key);
  $this->map = new MigrateSQLMap($this->machineName, array(
    'rid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'alias' => 'r',
    ),
  ), $destination_key);
}