Adding functionality to inject dependencies into an existing object #89

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
4 participants
@jflitton

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

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jul 24, 2013

Coverage Status

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

Coverage Status

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

@mnapoli

This comment has been minimized.

Show comment
Hide comment
@mnapoli

mnapoli Jul 24, 2013

Member

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!

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

This comment has been minimized.

Show comment
Hide comment
@mnapoli

mnapoli Jul 24, 2013

Member

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

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

This comment has been minimized.

Show comment
Hide comment
@jflitton

jflitton Jul 25, 2013

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/mnapoli/PHP-DI/pull/89#issuecomment-21518526
.

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/mnapoli/PHP-DI/pull/89#issuecomment-21518526
.

@mnapoli

This comment has been minimized.

Show comment
Hide comment
@mnapoli

mnapoli Jul 25, 2013

Member

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

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 referenced this pull request Jul 28, 2013

Merged

3.3 #90

7 of 7 tasks complete
@mnapoli

This comment has been minimized.

Show comment
Hide comment
@mnapoli

mnapoli Jul 28, 2013

Member

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

Here is the 3.3 PR: #90

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