Ticket #97 (closed enhancement: fixed)
Give injection provider more informations about requested injection
| Reported by: | mikey | Owned by: | mikey |
|---|---|---|---|
| Priority: | major | Milestone: | 0.6.0 |
| Component: | InversionOfControl | Version: | SVN-trunk |
| Keywords: | Cc: |
Description
I would like to have more information available inside an injection provider to allow the provider to decide which implementation (or concrete instance) to return. Consider the following:
$binder->bind('stubDatabaseConnection')->named('downloads')->toProvider(new DatabaseConnectionProvider('downloads'));
$binder->bind('stubDatabaseConnection')->named('press')->toProvider(new DatabaseConnectionProvider('press'));
$binder->bind('stubDatabaseConnection')->named('jobs')->toProvider(new DatabaseConnectionProvider('jobs'));
In this example you need several provider instances, one for each named injection. If the provider would know itself about the named annotation it could decide itself what to return. This would keep the amount of bindings lower, and one would only need one provider instance instead of several ones.
Change History
Note: See
TracTickets for help on using
tickets.
