Active
Project:
Drupal core
Version:
main
Component:
database system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
8 Oct 2019 at 22:22 UTC
Updated:
23 Apr 2022 at 04:23 UTC
Jump to comment: Most recent
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.
Convert extend to use the class resolver so it can be instantiated with a container and use dependency injection.
None.
None.
None.
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