Skip to content

Dynamic bindings #330

Open
Open
@samdark

Description

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'),
  ],
],

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions