Problem/Motivation
Right now, \Drupal\Core\Database\Query\Select::extend() uses the extender name to instantiate a class.
public function extend($extender_name) {
$override_class = $extender_name . '_' . $this->connection->driver();
if (class_exists($override_class)) {
$extender_name = $override_class;
}
return new $extender_name($this, $this->connection);
}This prevents any extenders using dependency injection.
Proposed resolution
Convert extend to use the class resolver so it can be instantiated with a container and use dependency injection.
Remaining tasks
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
Select query builder extensions can use dependency injection.
Comments
Comment #2
andypostComment #3
andypostBetter to combine the issues
Comment #8
andypostComment #9
andypostProbably it is now duplicate of #3217699: Convert select query extenders to backend-overrideable services
Comment #11
saphemmy commented@andypost which of these issues should be worked on this: #3086647-9: Allow Select query builder to use class resolver so we can use dependency injection or #3217699-52: Convert select query extenders to backend-overrideable services