public function OgMigrateMembership::__construct in Organic groups 7.2
General initialization of a Migration object.
Overrides OgEntityMigration::__construct
File
- includes/
migrate/ 7200/ og_og_membership.migrate.inc, line 23 - Re-populate group ID and group entity, deprecating the OG group entity.
Class
- OgMigrateMembership
- @file Re-populate group ID and group entity, deprecating the OG group entity.
Code
public function __construct($arguments = array()) {
$this->description = t('Re-populate group ID and group entity, deprecating the OG group entity.');
$query = db_select('og_membership', 'ogm');
$query
->innerJoin('og', 'og', 'ogm.gid = og.gid OR (ogm.group_type = og.entity_type AND ogm.gid = og.etid)');
$query
->fields('ogm', array(
'id',
'etid',
'entity_type',
'field_name',
));
$query
->addField('og', 'etid', 'gid');
$query
->addField('og', 'entity_type', 'group_type');
$this->query = $query;
parent::__construct($arguments);
$fields = array(
'id',
'group_type',
'gid',
'entity_type',
'etid',
'field_name',
);
foreach ($fields as $field) {
$this
->addFieldMapping($field, $field);
}
}