Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Allow to use any injection name if there is only 1 database #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vladgorenkin
Copy link

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.

@wolfy-j wolfy-j requested a review from SerafimArts June 15, 2021 10:51
@wolfy-j
Copy link
Member

wolfy-j commented Jun 15, 2021

Interesting sugar addition. Thank you

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants