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

l10n_migrate/src/Plugin/migrate/source/L10nServerLine.php
<?php

declare(strict_types=1);

namespace Drupal\l10n_migrate\Plugin\migrate\source;

use Drupal\Core\Database\Query\SelectInterface;
use Drupal\Core\Site\Settings;
use Drupal\migrate\Plugin\migrate\source\SqlBase;

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

  /**
   * {@inheritdoc}
   */
  public function query(): SelectInterface {
    $query = $this
      ->select('l10n_server_line', 'l')
      ->fields('l', ['pid', 'rid', 'fid', 'lineno', 'sid', 'type']);

    if ($pid = Settings::get('l10n_migrate_project_only')) {
      $query->condition('pid', $pid);
    }

    return $query;
  }

  /**
   * {@inheritdoc}
   */
  public function fields(): array {
    return [
      'fid' => $this->t('File ID'),
      'lineno' => $this->t('Line number'),
      'type' => $this->t('Type'),
      'sid' => $this->t('String ID'),
      'pid' => $this->t('Project ID'),
      'rid' => $this->t('Release ID'),
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getIds(): array {
    return [
      'fid' => [
        'type' => 'integer',
        'alias' => 'l',
      ],
      'lineno' => [
        'type' => 'integer',
        'alias' => 'l',
      ],
      'sid' => [
        'type' => 'integer',
        'alias' => 'l',
      ],
    ];
  }

}

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

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