public function WineTermMigration::__construct in Migrate 7.2
Same name and namespace in other branches
- 6.2 migrate_example/wine.inc \WineTermMigration::__construct()
General initialization of a Migration object.
Overrides AdvancedExampleMigration::__construct
3 calls to WineTermMigration::__construct()
- WineBestWithMigration::__construct in migrate_example/
wine.inc - General initialization of a Migration object.
- WineRegionMigration::__construct in migrate_example/
wine.inc - General initialization of a Migration object.
- WineVarietyMigration::__construct in migrate_example/
wine.inc - General initialization of a Migration object.
3 methods override WineTermMigration::__construct()
- WineBestWithMigration::__construct in migrate_example/
wine.inc - General initialization of a Migration object.
- WineRegionMigration::__construct in migrate_example/
wine.inc - General initialization of a Migration object.
- WineVarietyMigration::__construct in migrate_example/
wine.inc - General initialization of a Migration object.
File
- migrate_example/
wine.inc, line 106 - Advanced migration examples. These serve two purposes:
Class
Code
public function __construct($arguments, $type, $vocabulary_name, $description) {
parent::__construct($arguments);
$this->description = $description;
// Best practice as of Migrate 2.6 is to specify dependencies in
// hook_migrate_api. However, in this case, since we have a common class
// for a few different migrations, we'll specify this dependency here
// rather than repeatedly in hook_migrate_api().
$this->dependencies = array(
'WinePrep',
);
$query = db_select('migrate_example_wine_categories', 'wc')
->fields('wc', array(
'categoryid',
'name',
'details',
'category_parent',
'ordering',
))
->condition('type', $type)
->orderBy('category_parent', 'ASC');
$this->source = new MigrateSourceSQL($query);
$this->destination = new MigrateDestinationTerm($vocabulary_name);
$this->map = new MigrateSQLMap($this->machineName, array(
'categoryid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
), MigrateDestinationTerm::getKeySchema());
// Mapped fields
$this
->addFieldMapping('name', 'name');
$this
->addFieldMapping('description', 'details');
$this
->addFieldMapping('parent', 'category_parent')
->sourceMigration($this
->getMachineName());
$this
->addFieldMapping('weight', 'ordering');
$this
->addFieldMapping('format')
->defaultValue($this->basicFormat->format);
// Unmapped source fields
// Unmapped destination fields
$this
->addFieldMapping('parent_name')
->issueGroup(t('DNM'));
}