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

Nette Decorator, Search & DBAL extensions #37

Closed
solcik opened this issue Aug 6, 2019 · 7 comments · Fixed by #38
Closed

Nette Decorator, Search & DBAL extensions #37

solcik opened this issue Aug 6, 2019 · 7 comments · Fixed by #38

Comments

@solcik
Copy link
Member

solcik commented Aug 6, 2019

Nette DI in master register Decorator extension as last, which fixes the problem if somebody register subscribers via Search extension. But new problem occurs, since now Decorator beforeCompile is run after DBAL's beforeCompile, therefore Subscribers do not have tag yet.

nette/di#215 (comment)

@mabar
Copy link
Contributor

mabar commented Aug 6, 2019

Can you add SearchExtension to the first extensions? I guess it's the most reliable solution and we cannot solve it in nettrine/dbal https://github.com/nette/di/blob/master/src/DI/Compiler.php#L215

@solcik
Copy link
Member Author

solcik commented Aug 6, 2019

I am not sure, what that is going to solve?

The problem is that in nette/di@master decorator extension is processed in the end - after the DBAL's extension. So tags added via decorator are not taken into account in DBAL's extension beforeCompile method, which is registering subscribers to eventManager.

@mabar
Copy link
Contributor

mabar commented Aug 6, 2019

Oh, I see.
~~ Subscribers have no interface, so they could not be find through it. Alternative solution may be add listeners through config. We have a helper in contributte/di which helps to load services added through extension config. ~~

@mabar
Copy link
Contributor

mabar commented Aug 6, 2019

@f3l1x What do you think?

@solcik
Copy link
Member Author

solcik commented Aug 6, 2019

As I describe here: nette/di#215 (comment)

I am using it for Subscribers, which have interface

Doctrine\Common\EventSubscriber.

Listeners do not have interfaces, but these are registred via annotations

* @ORM\EntityListeners({"Acme\Subscriber\Doctrine\Listener\Sync"})

@mabar
Copy link
Contributor

mabar commented Aug 6, 2019

Sorry, I just noticed it too. Not sure why we choosed tags before 🤔
Can you send a PR replacing tags with interface?

@solcik
Copy link
Member Author

solcik commented Aug 6, 2019

Solved by #38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants