public function WebformLastDownload::__construct in Migrate Webform 7
General initialization of a Migration object.
Overrides Migration::__construct
File
- ./
lastdownload.inc, line 5
Class
Code
public function __construct(array $arguments) {
parent::__construct($arguments);
$simple_fields = array(
'requested',
);
$complex_fields = array(
'nid',
'uid',
'sid',
);
$fields = array_merge($simple_fields, $complex_fields);
$query = $this
->query($fields);
$table_name = 'webform_last_download';
$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',
),
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Source component ID',
'alias' => 'u',
),
), MigrateDestinationTable::getKeySchema($table_name));
$this
->addSimpleMappings($simple_fields);
$this
->addFieldMapping('nid', 'nid')
->sourceMigration($arguments['node_migrations']);
// Get users if configured
// Default uid to 1 if we're not mapping it.
if (variable_get('migrate_webform_user_map_ok', FALSE)) {
$this
->removeFieldMapping('uid');
$this
->addFieldMapping('uid', 'uid')
->sourceMigration(variable_get('migrate_webform_user_migration_class', ""))
->defaultValue(1);
}
else {
$this
->removeFieldMapping('uid');
$this
->addFieldMapping('uid', 'uid')
->defaultValue(1);
}
$this
->addFieldMapping('sid', 'sid')
->sourceMigration('WebformSubmissions');
}