l10n_server-2.x-dev/l10n_migrate/src/Plugin/migrate/source/L10nServerFile.php

l10n_migrate/src/Plugin/migrate/source/L10nServerFile.php
<?php
declare(strict_types=1);

namespace Drupal\l10n_migrate\Plugin\migrate\source;

use Drupal\Core\Site\Settings;
use Drupal\migrate\Plugin\migrate\source\SqlBase;
use Drupal\migrate\Row;

/**
 * Migrate Source plugin.
 *
 * @MigrateSource(
 *   id = "l10n_migrate_server_file",
 *   source_module = "l10n_migrate",
 * )
 */
class L10nServerFile extends SqlBase {

  /**
   * {@inheritdoc}
   */
  public function query() {
    $query = $this
      ->select('l10n_server_file', 'f')
      ->fields('f', ['fid', 'pid', 'rid', 'location', 'revision']);
    if ($pid = Settings::get('l10n_migrate_project_only')) {
      $query->condition('pid', $pid);
    }
    return $query;
  }

  /**
   * {@inheritdoc}
   */
  public function fields() {
    return [
      'fid' => $this->t('String ID'),
      'pid' => $this->t('Project ID'),
      'rid' => $this->t('Release ID'),
      'location' => $this->t('Location'),
      'revision' => $this->t('Revision'),
    ];
  }

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

  /**
   * {@inheritdoc}
   */
  // phpcs:ignore
  public function prepareRow(Row $row) {
    return parent::prepareRow($row);
  }

}

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

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