From 04165af6b788d9696cfb453b49dac6616b10aacc Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Tue, 7 Feb 2017 15:52:46 -0500 Subject: [PATCH] Eliminate ServiceLocatorAwareInterface from Params. --- .../VuFind/src/VuFind/Search/Base/Params.php | 24 +------------------ .../VuFind/Search/Params/PluginFactory.php | 4 +--- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/module/VuFind/src/VuFind/Search/Base/Params.php b/module/VuFind/src/VuFind/Search/Base/Params.php index f4159a7ed21..3af10ee4a3d 100644 --- a/module/VuFind/src/VuFind/Search/Base/Params.php +++ b/module/VuFind/src/VuFind/Search/Base/Params.php @@ -26,8 +26,6 @@ * @link https://vufind.org Main Page */ namespace VuFind\Search\Base; -use Zend\ServiceManager\ServiceLocatorAwareInterface, - Zend\ServiceManager\ServiceLocatorInterface; use VuFindSearch\Backend\Solr\LuceneSyntaxHelper, VuFindSearch\Query\Query, VuFindSearch\Query\QueryGroup; use VuFind\Search\QueryAdapter, VuFind\Solr\Utils as SolrUtils; @@ -43,12 +41,8 @@ use VuFind\Search\QueryAdapter, VuFind\Solr\Utils as SolrUtils; * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link https://vufind.org Main Page */ -class Params implements ServiceLocatorAwareInterface +class Params { - use \Zend\ServiceManager\ServiceLocatorAwareTrait { - setServiceLocator as setServiceLocatorThroughTrait; - } - /** * Internal representation of user query. * @@ -1660,22 +1654,6 @@ class Params implements ServiceLocatorAwareInterface return $this->selectedShards; } - /** - * Set the service locator. - * - * @param ServiceLocatorInterface $serviceLocator Locator to register - * - * @return Params - */ - public function setServiceLocator(ServiceLocatorInterface $serviceLocator) - { - // If this isn't the top-level manager, get its parent: - if ($serviceLocator instanceof ServiceLocatorAwareInterface) { - $serviceLocator = $serviceLocator->getServiceLocator(); - } - return $this->setServiceLocatorThroughTrait($serviceLocator); - } - /** * Translate a string (or string-castable object) * diff --git a/module/VuFind/src/VuFind/Search/Params/PluginFactory.php b/module/VuFind/src/VuFind/Search/Params/PluginFactory.php index cc12adc1424..9e4c4c3a02e 100644 --- a/module/VuFind/src/VuFind/Search/Params/PluginFactory.php +++ b/module/VuFind/src/VuFind/Search/Params/PluginFactory.php @@ -66,9 +66,7 @@ class PluginFactory extends \VuFind\ServiceManager\AbstractPluginFactory ->get('VuFind\SearchOptionsPluginManager')->get($requestedName); $class = $this->getClassName($name, $requestedName); $configLoader = $serviceLocator->getServiceLocator()->get('VuFind\Config'); - array_unshift($extraParams, $configLoader); // Clone the options instance in case caller modifies it: - array_unshift($extraParams, clone($options)); - return new $class(...$extraParams); + return new $class(clone($options), $configLoader, ...$extraParams); } } -- GitLab