public function RelationMigrateReference::__construct in Relation 8
Same name and namespace in other branches
- 8.2 relation_migrate/relation_migrate.migration.inc \RelationMigrateReference::__construct()
- 7 relation_migrate/relation_migrate.migration.inc \RelationMigrateReference::__construct()
Constructor.
Parameters
$field_type Field type machine name.:
4 calls to RelationMigrateReference::__construct()
- RelationMigrateEntityReference::__construct in relation_migrate/
relation_migrate.migration.inc - Constructor.
- RelationMigrateNodeReference::__construct in relation_migrate/
relation_migrate.migration.inc - Constructor.
- RelationMigrateTermReference::__construct in relation_migrate/
relation_migrate.migration.inc - Constructor.
- RelationMigrateUserReference::__construct in relation_migrate/
relation_migrate.migration.inc - Constructor.
4 methods override RelationMigrateReference::__construct()
- RelationMigrateEntityReference::__construct in relation_migrate/
relation_migrate.migration.inc - Constructor.
- RelationMigrateNodeReference::__construct in relation_migrate/
relation_migrate.migration.inc - Constructor.
- RelationMigrateTermReference::__construct in relation_migrate/
relation_migrate.migration.inc - Constructor.
- RelationMigrateUserReference::__construct in relation_migrate/
relation_migrate.migration.inc - Constructor.
File
- relation_migrate/
relation_migrate.migration.inc, line 19 - Migration for entityreference fields.
Class
Code
public function __construct($field_type) {
parent::__construct();
$this->fields = array_filter(variable_get('relation_migrate_' . $field_type . '_fields', array()));
$this->relation_type = variable_get('relation_migrate_' . $field_type . '_relation_type', NULL);
$this->dependencies = array();
$this->description = 'Copy the contents from the ' . $field_type . ' fields to relation entities.';
$this->map = new MigrateSQLMap($this->machineName, array(
'source_type' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'source_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'destination_type' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'destination_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'delta' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
), MigrateDestinationRelation::getKeySchema());
$this->destination = new MigrateDestinationRelation($this->relation_type);
$this
->addFieldMapping('uid')
->defaultValue(variable_get('relation_migrate_' . $field_type . '_user', 1))
->description(t('The owner of relation.'));
}