Skip to content

Commit

Permalink
Eliminate VuFindPluginInitializer. (#1069)
Browse files Browse the repository at this point in the history
- Implementing a setPluginManager method no longer triggers auto-injection.
  • Loading branch information
demiankatz committed Nov 1, 2017
1 parent 3b5edef commit 26ba981
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 62 deletions.
2 changes: 1 addition & 1 deletion module/VuFind/config/module.config.php
Expand Up @@ -304,14 +304,14 @@
'choiceauth' => 'VuFind\Auth\Factory::getChoiceAuth',
'facebook' => 'VuFind\Auth\Factory::getFacebook',
'ils' => 'VuFind\Auth\Factory::getILS',
'multiauth' => 'VuFind\Auth\Factory::getMultiAuth',
'multiils' => 'VuFind\Auth\Factory::getMultiILS',
'shibboleth' => 'VuFind\Auth\Factory::getShibboleth'
],
'invokables' => [
'cas' => 'VuFind\Auth\CAS',
'database' => 'VuFind\Auth\Database',
'ldap' => 'VuFind\Auth\LDAP',
'multiauth' => 'VuFind\Auth\MultiAuth',
'sip2' => 'VuFind\Auth\SIP2',
],
'aliases' => [
Expand Down
18 changes: 17 additions & 1 deletion module/VuFind/src/VuFind/Auth/Factory.php
Expand Up @@ -54,7 +54,9 @@ public static function getChoiceAuth(ServiceManager $sm)
$container = new \Zend\Session\Container(
'ChoiceAuth', $sm->getServiceLocator()->get('VuFind\SessionManager')
);
return new ChoiceAuth($container);
$auth = new ChoiceAuth($container);
$auth->setPluginManager($sm);
return $auth;
}

/**
Expand Down Expand Up @@ -154,6 +156,20 @@ public static function getManager(ServiceManager $sm)
return $manager;
}

/**
* Construct the MultiAuth plugin.
*
* @param ServiceManager $sm Service manager.
*
* @return MultiAuth
*/
public static function getMultiAuth(ServiceManager $sm)
{
$auth = new MultiAuth();
$auth->setPluginManager($sm);
return $auth;
}

/**
* Construct the MultiILS plugin.
*
Expand Down
Expand Up @@ -57,7 +57,7 @@ public function __construct($configOrContainerInstance = null,
) {
parent::__construct($configOrContainerInstance, $v3config);
$this->addInitializer(
'VuFind\ServiceManager\VuFindPluginInitializer', false
'VuFind\ServiceManager\ZendPluginInitializer', false
);
}

Expand Down

This file was deleted.

Expand Up @@ -53,7 +53,9 @@ public function getAuthObject($config = null)
if (null === $config) {
$config = $this->getAuthConfig();
}
$obj = clone $this->getAuthManager()->get('MultiAuth');
$manager = $this->getAuthManager();
$obj = clone $manager->get('MultiAuth');
$obj->setPluginManager($manager);
$obj->setConfig($config);
return $obj;
}
Expand Down

0 comments on commit 26ba981

Please sign in to comment.