You are here

public function WebformValidationRule::__construct in Migrate Webform 7

General initialization of a Migration object.

Overrides Migration::__construct

File

./validationrule.inc, line 5

Class

WebformValidationRule

Code

public function __construct(array $arguments) {
  parent::__construct($arguments);
  $simple_fields = array(
    'ruleid',
    'rulename',
    'validator',
    'data',
    'error_message',
  );
  $complex_fields = array(
    'nid',
  );
  $fields = array_merge($simple_fields, $complex_fields);
  $query = $this
    ->query($fields);
  $table_name = 'webform_validation_rule';
  $this->source = new MigrateSourceSQL($query, $fields, NULL, array(
    'map_joinable' => FALSE,
    'skip_count' => FALSE,
  ));
  $this->destination = new MigrateDestinationTable($table_name);
  $this->map = new MigrateSQLMap($this->machineName, array(
    'ruleid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'description' => 'Source node ID',
      'alias' => 'r',
    ),
  ), MigrateDestinationTable::getKeySchema($table_name));
  $this
    ->addSimpleMappings($simple_fields);
  $this
    ->addFieldMapping('nid', 'nid')
    ->sourceMigration($arguments['node_migrations']);
}