public function Select::extend in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Database/Query/Select.php \Drupal\Core\Database\Query\Select::extend()
Enhance this object by wrapping it in an extender object.
Parameters
$extender_name: The fully-qualified name of the extender class, without the leading '\' (for example, Drupal\my_module\myExtenderClass). The extender name will be checked against the current database connection to allow driver-specific subclasses as well, using the same logic as the query objects themselves.
Return value
\Drupal\Core\Database\Query\ExtendableInterface The extender object, which now contains a reference to this object.
Overrides ExtendableInterface::extend
File
- core/
lib/ Drupal/ Core/ Database/ Query/ Select.php, line 320
Class
- Select
- Query builder for SELECT statements.
Namespace
Drupal\Core\Database\QueryCode
public function extend($extender_name) {
$parts = explode('\\', $extender_name);
$class = end($parts);
$driver_class = $this->connection
->getDriverClass($class);
if ($driver_class !== $class) {
return new $driver_class($this, $this->connection);
}
return new $extender_name($this, $this->connection);
}