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

Adding functionality to inject dependencies into an existing object #89

Closed
wants to merge 2 commits into from
Closed

Conversation

jflitton
Copy link

Hi!

I've added functionality for injecting into an existing object. This is handy under certain testing circumstances and when you lack complete control over the instantiation of an object for some reason.

I added this functionality so that I could easily use PHP-DI in ZF2. While I haven't figured out a graceful way to use PHP-DI to instantiate controllers in ZF2's version of the dispatcher, I can at least get the resulting controller from Dispatch() and inject it after the fact.

Think this is worth integrating into your code base?

Thanks,

Jeff

@coveralls
Copy link

Coverage Status

Coverage decreased (-0%) when pulling dcf9441 on jflitton:master into 302191e on mnapoli:master.

@mnapoli
Copy link
Member

mnapoli commented Jul 24, 2013

Hi, this is awesome. We were talking about this in #84 so this would fit great for a v3.3.

By the way if you have integrated it with ZF2, I would love to know how you did it, I can add it to the documentation (or if you have time and motivation you can also submit a PR with a new documentation file).

I've look more closely at your PR in the next days.

Thanks!

@mnapoli
Copy link
Member

mnapoli commented Jul 24, 2013

And by the way it seems your commits show your name as author, but are not linked to your GitHub account (there is no link on your name). It's not really a problem unless you want your commits to link to your account, and to be correctly recognized as a "contributor" to the project by Github.

I've had this problem too, unless you do this on purpose this is probably because you don't have the email set up either in git, or in github. See: Commits on GitHub don't link to my account

@jflitton
Copy link
Author

Thanks, I hadn't yet set my public e-mail up properly on github.

-Jeff

On Wed, Jul 24, 2013 at 3:43 PM, Matthieu Napoli
notifications@github.comwrote:

And by the way it seems your commits show your name as author, but are not
linked to your GitHub account (there is no link on your name). It's not
really a problem unless you want your commits to link to your account, and
to be correctly recognized as a "contributor" to the project by Github.

I've had this problem too, unless you do this on purpose this is probably
because you don't have the email set up either in git, or in github. See: Commits
on GitHub don't link to my accounthttps://help.github.com/articles/setting-your-email-in-git#commits-on-github-dont-link-to-my-account


Reply to this email directly or view it on GitHubhttps://github.com//pull/89#issuecomment-21518526
.

@mnapoli
Copy link
Member

mnapoli commented Jul 25, 2013

@jflitton FYI I created the PHP-DI-ZF2 repository (empty for now): https://github.com/mnapoli/PHP-DI-ZF2

@mnapoli mnapoli mentioned this pull request Jul 28, 2013
Merged
7 tasks
@mnapoli
Copy link
Member

mnapoli commented Jul 28, 2013

Thanks, I've merged your PR manually into a new 3.3 branch.

Here is the 3.3 PR: #90

@mnapoli mnapoli closed this Jul 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants