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

DI: blacklist of classes excluded from autowiring #1424

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
3 participants
@matej21
Copy link
Contributor

commented Feb 23, 2014

This prevents from autowiring generic typehints like IContainer.

example: You have some component (in my case it was visual paginator) and factory interface. You register that factory in DI container. Then you register some presenter in DI container. Because VisualPaginator has constructor from ComponentModel\Component (__construct(IContainer $parent = NULL...), nette tries to autowire presenter. And this may cause serious problems. This PR excludes Component, Container etc. from autowiring. Of course, you still can autowire all descendants which are not blacklisted. (so you cannot autowire UI\Presenter but you can autowire FooPresenter)

As a side effect, this PR shrinks down the size of generated container :)

@JanTvrdik

This comment has been minimized.

Copy link
Contributor

commented Feb 23, 2014

I really like the idea, not so much the actual implementation.

@matej21

This comment has been minimized.

Copy link
Contributor Author

commented Feb 23, 2014

@JanTvrdik: Can you be more specific?

@hrach hrach added 1-feature labels Mar 7, 2014

@matej21

This comment has been minimized.

Copy link
Contributor Author

commented Mar 17, 2014

cc @dg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.