You are here

protected function Role::initializeIterator in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/user/src/Plugin/migrate/source/d6/Role.php \Drupal\user\Plugin\migrate\source\d6\Role::initializeIterator()

Initializes the iterator with the source data.

Return value

\Iterator Returns an iteratable object of data for this source.

Overrides SqlBase::initializeIterator

File

core/modules/user/src/Plugin/migrate/source/d6/Role.php, line 48

Class

Role
Drupal 6 role source from database.

Namespace

Drupal\user\Plugin\migrate\source\d6

Code

protected function initializeIterator() {
  $filter_roles = $this
    ->select('filter_formats', 'f')
    ->fields('f', [
    'format',
    'roles',
  ])
    ->execute()
    ->fetchAllKeyed();
  foreach ($filter_roles as $format => $roles) {

    // Drupal 6 code: $roles = ','. implode(',', $roles) .',';
    // Remove the beginning and ending comma.
    foreach (explode(',', trim($roles, ',')) as $rid) {
      $this->filterPermissions[$rid][] = $format;
    }
  }
  return parent::initializeIterator();
}