{% extends "base/class.php.twig" %}

{% block file_path %}
\Drupal\{{module}}\Plugin\migrate\source\{{class_name}}.
{% endblock %}

{% block namespace_class %}
namespace Drupal\{{module}}\Plugin\migrate\source;
{% endblock %}

{% block use_class %}
use Drupal\migrate\Plugin\migrate\source\SqlBase;
{% endblock %}

{% block class_declaration %}
/**
 * Provides a '{{class_name}}' migrate source.
 *
 * @MigrateSource(
 *  id = "{{plugin_id}}"
 * )
 */
class {{class_name}} extends SqlBase {% endblock %}
{% block class_methods %}
  /**
   * {@inheritdoc}
   */
  public function query() {

    return $this->select('{{table}}', '{{alias}}')
      ->fields('{{alias}}'){% if group_by %}
      ->groupBy('{{alias}}.{{group_by}}')
      {% endif %};
  }

  /**
   * {@inheritdoc}
   */
  public function fields() {
    $fields = [
    {% for field in fields %}
  '{{field.id}}' => $this->t('{{field.description}}'),
    {% endfor %}
];
    return $fields;
  }

  /**
   * {@inheritdoc}
   */
  public function getIds() {
    return [
    ];
  }
{% endblock %}
