601bbd942b785d2eb8628586959205b84e75b8e3
[yaffs-website] / web / core / modules / migrate / tests / modules / migrate_high_water_test / src / Plugin / migrate / source / HighWaterTest.php
1 <?php
2
3 namespace Drupal\migrate_high_water_test\Plugin\migrate\source;
4
5 use Drupal\migrate\Plugin\migrate\source\SqlBase;
6
7 /**
8  * Source plugin for migration high water tests.
9  *
10  * @MigrateSource(
11  *   id = "high_water_test"
12  * )
13  */
14 class HighWaterTest extends SqlBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public function query() {
20     $field_names = array_keys($this->fields());
21     $query = $this
22       ->select('high_water_node', 'm')
23       ->fields('m', $field_names);
24     foreach ($field_names as $field_name) {
25       $query->groupBy($field_name);
26     }
27     return $query;
28   }
29
30   /**
31    * {@inheritdoc}
32    */
33   public function fields() {
34     $fields = [
35       'id' => $this->t('Id'),
36       'title' => $this->t('Title'),
37       'changed' => $this->t('Changed'),
38     ];
39
40     return $fields;
41   }
42
43   /**
44    * {@inheritdoc}
45    */
46   public function getIds() {
47     return [
48       'id' => [
49         'type' => 'integer',
50       ],
51     ];
52   }
53
54 }