zendframework / zend-feed

Feed component from Zend Framework
BSD 3-Clause "New" or "Revised" License
166 stars 42 forks source link

Add ExtensionManagerInterface to ExtensionPluginManager. #22

Closed demiankatz closed 7 years ago

demiankatz commented 8 years ago

Perhaps there is a reason for this omission, but it seems potentially accidental to me.

My use case is that I need to add/override some plugin services. Previously, I was able to call \Zend\Feed\Writer\Writer::getExtensionManager() and then call setInvokableClass() on the resulting object. The refactoring to use StandaloneExtensionManager broke this technique, since that new static default does not define full plugin manager functionality (thus, setInvokableClass is undefined).

It seems that one possible solution to my problem is to create and inject the necessary custom plugin manager, like this:

    $manager = new ExtensionPluginManager();
    $manager->setInvokableClass(...);
    Writer::setExtensionManager($manager);

However, the setExtensionManager call fails because ExtensionPluginManager does not conform to the ExtensionManagerInterface. If I simply add the required interface, then my code works as expected.

I understand that there is currently some work going on to refactor from the existing static approach to something more dynamic. I would support that -- adding/overriding plugins in this code is currently unnecessarily painful! But I submit this pull request in case this helps me move forward with my code in the meantime, and in case it helps with anyone else's backward compatibility issues.

demiankatz commented 8 years ago

@weierophinney, this PR has been sitting for a few months without comment -- is there any chance it will eventually be reviewed or merged? Is there a better forum for discussing these types of issues? I'm willing to contribute some more time to improving this library if that would be helpful, but input from the maintainers would be very helpful. Thanks!

demiankatz commented 7 years ago

@Xerkus, not sure if this one is on your radar, but this is an issue that has been blocking me for over a year, and I think the fix is simple and harmless. Any chance you have time to take a look at this one? As always, please let me know if you need anything more from me to solve this, or if I can help in some other area to compensate for your time here.

Xerkus commented 7 years ago

@demiankatz I never used this component since zf1 but i will take a look.

demiankatz commented 7 years ago

Thanks, @Xerkus!