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\Site\Settings; use Drupal\migrate\Plugin\migrate\source\SqlBase; use Drupal\migrate\Row; /** * Migrate Source plugin. * * @MigrateSource( * id = "l10n_migrate_server_line", * source_module = "l10n_migrate", * ) */ class L10nServerLine extends SqlBase { /** * {@inheritdoc} */ public function query() { $query = $this ->select('l10n_server_line', 'l') ->fields('l', ['lid', 'pid', 'rid', 'fid', 'lineno', 'sid', 'type']); if ($pid = Settings::get('l10n_migrate_project_only')) { $query->condition('pid', $pid); } return $query; } /** * {@inheritdoc} */ public function fields() { return [ 'lid' => $this->t('Line ID'), 'pid' => $this->t('Project ID'), 'rid' => $this->t('Release ID'), 'fid' => $this->t('File ID'), 'lineno' => $this->t('Line number'), 'sid' => $this->t('String ID'), 'type' => $this->t('Type'), ]; } /** * {@inheritdoc} */ public function getIds() { // @todo Do we need a unique id for migration? return []; } /** * {@inheritdoc} */ // phpcs:ignore public function prepareRow(Row $row) { return parent::prepareRow($row); } }