Added call method to the container. #116
Merged
Conversation
The call method allows you to execute a callable and inject its dependencies using the container.
freost
added a commit
that referenced
this pull request
Nov 9, 2014
Added call method to the container.
Nice addition to the container :) Executing route actions through the container sounds like a useful feature. It'll make it possible to inject common dependencies through the constructor while specific dependencies are injected into the method/closure that actually need them. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Ok as promised here's the second pull request for the container class. 100% backwards compatible and tested.
The new call method allows you to execute a callable and inject its dependencies using the container.
I have a third pull request that I'm working on but its a bit bigger so I'll probably wait until tomorrow since its getting pretty late here. I have a working prototype but I want to go through the code and write some more tests for it.
What I'm working on is making the route dispatcher execute the action using the
Container::call
method. This will enable us to inject dependencies directly into the rote controller methods and/or closures. We're converting some Silex applications to Mako and its a pretty useful feature that they have.It would also be nice to do the same for task actions and possibly migrations as well.