Reputation: 10599
I am going to write my own abstract factory, similar to the Zend\Log\LoggerAbstractServiceFactory
. I noticed that this abstract factory works with plugin managers, but I am wondering exactly what the purpose of plugin managers is - both in general and in this particular example. The Zend\Log
namespace includes multiple plugin managers such as WriterPluginManager
and ProcessorPluginManager
, while the Zend\Log\Writer
namespace includes the FormatterPluginManager
class. Basically I am confused as to what exactly these plugin managers do.
I know that there are several plugin managers for controller plugins, view helpers, etc., and I noticed that a plugin manager is a specialized service locator because the Zend\ServiceManager\AbstractPluginManager
class extends Zend\ServiceManager\ServiceManager
.
So my question is: what is the purpose of plugin managers, both in general, and in the concrete example of the Zend\Log
namespace? I couldn't really find any documentation on this.
Upvotes: 1
Views: 766
Reputation: 33148
A plugin manager is a special service manager which returns a particular type of services. They define a validatePlugin()
method which checks that the service is indeed of the correct type. From the examples you gave, WriterPluginManager
returns log writers and ProcessorPluginManager
unsurprisingly returns log processors.
You shouldn't need to worry too much about the specifics of this as long as your abstract factory returns classes implementing the correct interface.
Upvotes: 2
Reputation: 530
pluginManager created to manage controller plugin . controller plugin execute on all request for example if you want check authorization or log , best place is controller plugin or any task should do on all request .
Upvotes: 0