"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/modules/migrate/src/Plugin/migrate/source/DummyQueryTrait.php" (26 Nov 2020, 810 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "DummyQueryTrait.php" see the Fossies "Dox" file reference documentation.

    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 arbitrary 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 }