Closed JanMikes closed 6 years ago
Well, I do not think its a bug. Rather than internally remove duplicate service (Kdyby), I would disable autowiring for that service.
What do you think? Why are you using this package with Kdyby/Events.
Yeah, that seems reasonable, i will try to update the PR.
Unfortunately i need doctrine events in my project. I am dispatching domain events (exactly this way) from my entities and i do not know about any other doctrine events implementation into nette at this moment.
Don't get me wrong, I still think it's better to disable autowiring directly in your app's config. You're are using Kdyby\Events + Contributte\EventDispatcher together, you have to handle it by your self.
services:
kdyby_events.dispatcher:
autowire: off # or self
It's preferable way for me. No hidden magic.
Ah sure, thank you, this works. Just to make it correct, this is exactly what has to be added to config:
services:
events.symfonyProxy:
autowired: off
Thanks anyway.
Hi, after replacing
symplify/symfony-event-dispatcher
withcontributte/event-dispatcher
i am getting following error:Nette\DI\ServiceCreationException: Multiple services of type Symfony\Component\EventDispatcher\EventDispatcherInterface found: events.symfonyProxy, _21.dispatcher
It is because i am using
Kdyby/Events
in my project and it registers symfony event dispatcher as well.This problem was already solved in symplify https://github.com/DeprecatedPackages/SymfonyEventDispatcher/blob/master/src/Adapter/Nette/DI/SymfonyEventDispatcherExtension.php#L42
Do you plan to fix it? Or any other tips how to get rid of
Kdyby/Events
? 😄Thank you