public function WebformComponents::__construct in Migrate Webform 7
General initialization of a Migration object.
Overrides Migration::__construct
File
- ./
components.inc, line 5
Class
Code
public function __construct(array $arguments) {
parent::__construct($arguments);
$simple_fields = array(
'cid',
'pid',
'form_key',
'name',
'type',
'value',
'extra',
'weight',
);
$complex_fields = array(
'nid',
'mandatory',
);
$fields = array_merge($simple_fields, $complex_fields);
$query = $this
->query($fields);
$table_name = 'webform_component';
$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(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Source node ID',
'alias' => 'n',
),
'cid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Source component ID',
'alias' => 'c',
),
), MigrateDestinationTable::getKeySchema($table_name));
$this
->addSimpleMappings($simple_fields);
$this
->addFieldMapping('required', 'mandatory');
$this
->addFieldMapping('nid', 'nid')
->sourceMigration($arguments['node_migrations']);
// is private_file enabled on the d6 site?
$connection = Database::getConnection('default', $arguments['source_connection']);
$query = $connection
->select('system', 's')
->fields('s', array(
'status',
));
$query
->condition('s.name', 'private_files', '=');
$this->private_file = $query
->execute()
->fetchField();
}