trait DummyQueryTrait
Same name in other branches
- 8.9.x core/modules/migrate/src/Plugin/migrate/source/DummyQueryTrait.php \Drupal\migrate\Plugin\migrate\source\DummyQueryTrait
- 10 core/modules/migrate/src/Plugin/migrate/source/DummyQueryTrait.php \Drupal\migrate\Plugin\migrate\source\DummyQueryTrait
- 11.x core/modules/migrate/src/Plugin/migrate/source/DummyQueryTrait.php \Drupal\migrate\Plugin\migrate\source\DummyQueryTrait
Provides a dummy select query object for source plugins.
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 is not used for iteration.
Hierarchy
- trait \Drupal\migrate\Plugin\migrate\source\DummyQueryTrait
2 files declare their use of DummyQueryTrait
- UploadInstance.php in core/
modules/ file/ src/ Plugin/ migrate/ source/ d6/ UploadInstance.php - UserPictureInstance.php in core/
modules/ user/ src/ Plugin/ migrate/ source/ UserPictureInstance.php
File
-
core/
modules/ migrate/ src/ Plugin/ migrate/ source/ DummyQueryTrait.php, line 13
Namespace
Drupal\migrate\Plugin\migrate\sourceView source
trait DummyQueryTrait {
/**
* {@inheritdoc}
*/
public function query() {
// Pass an arbitrary table name - the query should never be executed
// anyway.
$query = $this->select(uniqid(), 's')
->range(0, 1);
$query->addExpression('1');
return $query;
}
/**
* {@inheritdoc}
*/
protected function doCount() {
return 1;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|
DummyQueryTrait::doCount | protected | function | 1 | |
DummyQueryTrait::query | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.