Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic bindings #330

Open
samdark opened this issue May 24, 2023 · 2 comments · May be fixed by #352
Open

Dynamic bindings #330

samdark opened this issue May 24, 2023 · 2 comments · May be fixed by #352
Labels
type:feature New feature

Comments

@samdark
Copy link
Member

samdark commented May 24, 2023

Container:

'connection' => [ ... ],
'connection2' => [ ... ],

bindings.php:

'ConnectionInterface' => [
  // When namespace starts with `App\Secondary`, pass `connection2` for `ConnectionInterface`.
  [
      'namespace' => 'App\Secondary',
      'definition' => Reference::to('connection2'),
  ],
  // When parameter name is `secondaryConnection`, pass `connection2` for `ConnectionInterface`.
  [
      'parameterName' => 'secondaryConnection',
      'definition' => Reference::to('connection2'),
  ],
],
@samdark samdark added the type:feature New feature label May 24, 2023
@samdark
Copy link
Member Author

samdark commented May 24, 2023

Using this feature may degrade overall container performance.

@xepozz xepozz linked a pull request Feb 13, 2024 that will close this issue
@xepozz
Copy link
Member

xepozz commented Feb 13, 2024

// When parameter name is secondaryConnection, pass connection2 for ConnectionInterface.
[
'parameterName' => 'secondaryConnection',
'definition' => Reference::to('connection2'),
],

It's done in #352

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants