database
database copied to clipboard
Allow to use any injection name if there is only 1 database
It'd be great if we could use db or database (or any other name) as argument names if there is only one database declared.
Currently you have to use default database name as an injection argument:
// database config
return [
'default' => 'default',
'databases' => [
'default' => [
'driver' => 'postgres',
],
],
...
]
// some service
public function __construct(private DatabaseInterface $default) {}
private DatabaseInterface $db would throw an exception: db preset was not found.
Interesting sugar addition. Thank you