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

Future? #97

Open
fprochazka opened this issue May 1, 2016 · 5 comments
Open

Future? #97

fprochazka opened this issue May 1, 2016 · 5 comments

Comments

@fprochazka
Copy link
Member

fprochazka commented May 1, 2016

I have the following idea:

  • move the support for lazy EventManager of Doctrine to Kdyby/Doctrine, like symfony has it
  • this extension will only provide events mechanism for Nette (possibly rename to kdyby/events-nette?)
    • should we completely drop all custom code and base it of Symfony/EventDispatcher?
    • should we continue to support custom impl of EventManager?

The thing is, I don't think mixing the event mechanisms is a good idea anymore. I think you should be able to use both systems independently, without collisions.

  • You wanna create a listener for symfony/console? Great, use Symnedi/EventDispatcher and bind it there.
  • Wanna create a listener for some "nette events?" ok, use Kdyby/Events listener.

What do you guys think?

@enumag
Copy link
Member

enumag commented May 1, 2016

move the support for lazy EventManager of Doctrine to Kdyby/Doctrine, like symfony has it

I disagree. This is a different case. In Symfony it's in DoctrineBridge which integrates doctrine packages into various symfony components - in this case EventManager to symfony/dependency-injection. The important note here is that DoctrineBridge only depends on doctrine/common, so unless you want to do the same with Kdyby/Doctrine it does not belong there in my opinion.

As for EventDispatcher I'm currently writing my own integration to Nette (almost done). I didn't like a few things in Symnedi/EventDispatcher (no ContainerAwareEventDispatcher, no tag for subscribers) and didn't want to BC break it so I'll deprecate it instead with a new package.

Otherwise I agree that mixing the event mechanisms is wrong. That is why I'm trying to get rid of Kdyby/Events completely in my application. What I'm aiming for is to use:

  • simple ContainerAwareEventManager for Doctrine events only (no namespaces or other cool features) - implemented here
  • symfony/event-dispatcher for everything else (I'll publish my package next week)
  • no integration of property-based events from Nette to either of these systems
  • only exception is that Nette\Application\Application::onWhatever will trigger appropriate event in the dispatcher (inspired by Symnedi)

@fprochazka
Copy link
Member Author

simple ContainerAwareEventManager for Doctrine events only

It could be moved to a separate package, that's a detail. My point is, that it's IMHO needed anyway and it could simplify Kdyby/Events.

@enumag
Copy link
Member

enumag commented May 1, 2016

I agree. I didn't do that because I actually used the ContainerAwareEventManager from symfony/doctrine-bridge and connected it to Nette/DI using ContainerAdapter. If I implemented a ContainerAwareEventManager which would work with Nette\DI\Container directly it would be in a separate package for sure. I might do it in the future if you don't do it first.

Same goes for EventDispatcher - for now I'll use ContainerAwareEventDispatcher from symfony + the mentioned ContainerAdapter.

@enumag
Copy link
Member

enumag commented May 5, 2016

Here is my integration of EventDispatcher: https://github.com/Arachne/EventDispatcher

And I decided to put the EventManager in a separate package as well: https://github.com/Arachne/EventManager

Both packages are implemented to be as simple as possible.

@fprochazka
Copy link
Member Author

fprochazka commented May 13, 2017

So, the future:

  • I'll release new Nette 2.3 and 2.4 versions
  • Add lazy Doctrine EventManager to kdyby/doctrine
  • deprecate this (no more development, just bugfixes)
  • I might create a bridge for magic Nette\Object events binding to symfony/event-dispatcher

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

No branches or pull requests

2 participants