/** * Constructor * * Add a default initializer to ensure the plugin is valid after instance * creation. * * Additionally, the constructor provides forwards compatibility with v3 by * overloading the initial argument. v2 usage expects either null or a * ConfigInterface instance, and will ignore any other arguments. v3 expects * a ContainerInterface instance, and will use an array of configuration to * seed the current instance with services. In most cases, you can ignore the * constructor unless you are writing a specialized factory for your plugin * manager or overriding it. * * @param null|ConfigInterface|ContainerInterface $configOrContainerInstance * @param array $v3config If $configOrContainerInstance is a container, this * value will be passed to the parent constructor. * @throws Exception\InvalidArgumentException if $configOrContainerInstance * is neither null, nor a ConfigInterface, nor a ContainerInterface. */ public function __construct($configOrContainerInstance = null, array $v3config = []) { if (empty($v3config) && $configOrContainerInstance instanceof ContainerInterface) { $config = $configOrContainerInstance->get('Config'); if (isset($config['migration_manager'])) { $v3config = $config['migration_manager']; } } parent::__construct($configOrContainerInstance, $v3config); $this->addInitializer([$this, 'dbAdapterInitializer'], false); $this->addInitializer([$this, 'consoleAdapterInitializer'], false); }
/** * Constructor * * @param ConfigInterface $config */ public function __construct(ConfigInterface $config = null) { if ($config) { $config->configureServiceManager($this); } }