Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / migrate / src / Plugin / migrate / source / DummyQueryTrait.php
1 <?php
2
3 namespace Drupal\migrate\Plugin\migrate\source;
4
5 /**
6  * Provides a dummy select query object for source plugins.
7  *
8  * Trait providing a dummy select query object for source plugins based on
9  * SqlBase which override initializeIterator() to obtain their data from other
10  * SqlBase services instead of a direct query. This ensures that query() returns
11  * a valid object, even though it is not used for iteration.
12  */
13 trait DummyQueryTrait {
14
15   /**
16    * {@inheritdoc}
17    */
18   public function query() {
19     // Pass an arbritrary table name - the query should never be executed
20     // anyway.
21     $query = $this->select(uniqid(), 's')
22       ->range(0, 1);
23     $query->addExpression('1');
24     return $query;
25   }
26
27   /**
28    * {@inheritdoc}
29    */
30   public function count($refresh = FALSE) {
31     return 1;
32   }
33
34 }