You are here

function migrate_webform_get_roles in Migrate Webform 7

1 call to migrate_webform_get_roles()
migrate_webform_migrate_api in ./migrate_webform.migrate.inc

File

./migrate_webform.module, line 152
Migrate does not use this file. So global helper functions could go here.

Code

function migrate_webform_get_roles() {
  $query = Database::getConnection('default', variable_get('migrate_webform_source_database', 'default'))
    ->select('role', 'r')
    ->fields('r');
  foreach ($query
    ->execute() as $row) {
    $items[$row->rid]['value'] = $row->name;
  }
  $query = db_select('role', 'r')
    ->fields('r');
  foreach ($query
    ->execute() as $row) {
    foreach ($items as $old => $name) {
      if ($name['value'] == $row->name) {
        $items[$old]['new'] = $row->rid;
      }
    }
  }
  return $items;
}