function Select::orderRandom
Same name in this branch
- 8.9.x core/lib/Drupal/Core/Database/Driver/pgsql/Select.php \Drupal\Core\Database\Driver\pgsql\Select::orderRandom()
Same name in other branches
- 9 core/modules/pgsql/src/Driver/Database/pgsql/Select.php \Drupal\pgsql\Driver\Database\pgsql\Select::orderRandom()
- 9 core/lib/Drupal/Core/Database/Query/Select.php \Drupal\Core\Database\Query\Select::orderRandom()
- 10 core/modules/pgsql/src/Driver/Database/pgsql/Select.php \Drupal\pgsql\Driver\Database\pgsql\Select::orderRandom()
- 10 core/lib/Drupal/Core/Database/Query/Select.php \Drupal\Core\Database\Query\Select::orderRandom()
- 11.x core/modules/pgsql/src/Driver/Database/pgsql/Select.php \Drupal\pgsql\Driver\Database\pgsql\Select::orderRandom()
- 11.x core/lib/Drupal/Core/Database/Query/Select.php \Drupal\Core\Database\Query\Select::orderRandom()
Overrides SelectInterface::orderRandom
1 method overrides Select::orderRandom()
- Select::orderRandom in core/
lib/ Drupal/ Core/ Database/ Driver/ pgsql/ Select.php - Orders the result set by a random value.
File
-
core/
lib/ Drupal/ Core/ Database/ Query/ Select.php, line 670
Class
- Select
- Query builder for SELECT statements.
Namespace
Drupal\Core\Database\QueryCode
public function orderRandom() {
$alias = $this->addExpression('RAND()', 'random_field');
$this->orderBy($alias);
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.