public function MigrateDestinationOGMembership::import in Migrate Extras 6.2
Import a single membership.
Parameters
$entity: Object object to build. Prefilled with any fields mapped in the Migration.
$row: Raw source data object - passed through to prepare/complete handlers.
Return value
array Array of key fields of the object that was saved if successful. FALSE on failure.
Overrides MigrateDestination::import
File
- ./
og.inc, line 54 - Import Organic group memberships.
Class
- MigrateDestinationOGMembership
- Destination class implementing migration into og_uid table.
Code
public function import(stdClass $entity, stdClass $row) {
if (empty($entity->gid)) {
throw new MigrateException('Missing $entity->gid');
}
if (empty($entity->uid)) {
throw new MigrateException('Missing $entity->uid');
}
// TODO
$args = array(
'is_active' => $entity->is_active,
'is_admin' => $entity->is_admin,
'created' => $entity->created,
);
og_save_subscription($entity->gid, $entity->uid, $args);
// No failure handling in OG
return array(
$entity->gid,
$entity->uid,
);
}