public function WineTableMigration::__construct in Migrate 6.2
Same name and namespace in other branches
- 7.2 migrate_example/wine.inc \WineTableMigration::__construct()
General initialization of a Migration object.
Overrides AdvancedExampleMigration::__construct
File
- migrate_example/
wine.inc, line 760 - Advanced migration examples. These serve two purposes:
Class
Code
public function __construct() {
parent::__construct();
$this->description = 'Miscellaneous table data';
$this->softDependencies = array(
'WineComment',
);
$table_name = 'migrate_example_wine_table_dest';
$this->map = new MigrateSQLMap($this->machineName, array(
'fooid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
), MigrateDestinationTable::getKeySchema($table_name));
$query = db_select('migrate_example_wine_table_source', 't')
->fields('t', array(
'fooid',
'field1',
'field2',
));
$this->source = new MigrateSourceSQL($query);
$this->destination = new MigrateDestinationTable($table_name);
// Mapped fields
$this
->addFieldMapping('drupal_text', 'field1');
$this
->addFieldMapping('drupal_int', 'field2');
$this
->addUnmigratedDestinations(array(
'recordid',
));
}