DummyQueryTrait.php in Zircon Profile 8
Same filename and directory in other branches
Namespace
Drupal\migrate\Plugin\migrate\sourceFile
core/modules/migrate/src/Plugin/migrate/source/DummyQueryTrait.phpView source
<?php
/**
* @file
* Contains \Drupal\migrate\Plugin\migrate\source\DummyQueryTrait.
*/
namespace Drupal\migrate\Plugin\migrate\source;
/**
* Trait providing a dummy select query object for source plugins based on
* SqlBase which override initializeIterator() to obtain their data from other
* SqlBase services instead of a direct query. This ensures that query() returns
* a valid object, even though it isn't used for iteration.
*/
trait DummyQueryTrait {
/**
* {@inheritdoc}
*/
public function query() {
// Pass an arbritrary table name - the query should never be executed anyway.
$query = $this
->select(uniqid(), 's')
->range(0, 1);
$query
->addExpression('1');
return $query;
}
/**
* {@inheritdoc}
*/
public function count() {
return 1;
}
}
Traits
Name | Description |
---|---|
DummyQueryTrait | Trait providing a dummy select query object for source plugins based on SqlBase which override initializeIterator() to obtain their data from other SqlBase services instead of a direct query. This ensures that query() returns a valid object, even… |