FriendsOfFlarum / split

Split Flarum posts into a new discussion
MIT License
12 stars 14 forks source link

Stop injecting dependencies for listening to events #19

Closed franzliedke closed 5 years ago

franzliedke commented 5 years ago

When we register listeners for events via subscribers that have dependencies, this means that their constructor dependencies will be injected (and thus instantiated) at the time of registering these subscribers.

This can cause problems when other extensions want to extend the thing you are injecting, but don't get the chance to do so because this extension already injected (and thus built) that thing once.

When using event listeners without this mechanism, they (and therefore their dependencies) will only be instantiated when the event is actually fired. That's what this PR does - it should fix a conflict with another extension that we've been having on discuss.flarum.org.

Thanks for this extension! :heart: