drupalorg_migrate-1.0.x-dev/src/Plugin/migrate/source/UserSectionEditor.php

src/Plugin/migrate/source/UserSectionEditor.php
<?php

namespace Drupal\drupalorg_migrate\Plugin\migrate\source;

use Drupal\migrate\Plugin\migrate\source\SqlBase;

/**
 * Migrate source plugin for user-section editor assignments.
 *
 * @MigrateSource(
 *   id = "user_section_editor"
 * )
 */
class UserSectionEditor extends SqlBase {

  /**
   * {@inheritdoc}
   */
  public function query() {
    $query = $this->select('og_membership', 'ogm')
      ->fields('ogm', ['etid', 'gid'])
      ->condition('ogm.entity_type', 'user');
    return $query;
  }

  /**
   * {@inheritdoc}
   */
  public function fields() {
    return [
      'etid' => $this->t('User Entity ID'),
      'gid' => $this->t('Group ID'),
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getIds() {
    return [
      'etid' => [
        'type' => 'integer',
        'alias' => 'ogm',
      ],
      'gid' => [
        'type' => 'integer',
        'alias' => 'ogm',
      ],
    ];
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc