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

l10n_migrate/src/Plugin/migrate/source/L10nServerError.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_error",
 *   source_module = "l10n_migrate",
 * )
 */
class L10nServerError extends SqlBase {

  /**
   * {@inheritdoc}
   */
  public function query(): SelectInterface {
    $query = $this
      ->select('l10n_server_error', 'e')
      ->fields(
        'e',
        [
          'eid',
          'rid',
          'value',
        ]
      );

    if ($pid = Settings::get('l10n_migrate_project_only')) {
      $query->innerJoin('l10n_server_release', 'r', 'e.rid = r.rid');
      $query->condition('r.pid', $pid);
    }

    return $query;
  }

  /**
   * {@inheritdoc}
   */
  public function fields(): array {
    return [
      'eid' => $this->t('String ID'),
      'rid' => $this->t('Release ID'),
      'value' => $this->t('Value'),
    ];
  }

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

}

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

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