diff --git a/module/VuFind/src/VuFind/Db/Row/ServiceLocatorAwareGateway.php b/module/VuFind/src/VuFind/Db/Row/ServiceLocatorAwareGateway.php index 019fb1b6ad4869884e4a4b038260931c02c0015e..99d40adbc44249fac0383c386fc8f763b4cb382d 100644 --- a/module/VuFind/src/VuFind/Db/Row/ServiceLocatorAwareGateway.php +++ b/module/VuFind/src/VuFind/Db/Row/ServiceLocatorAwareGateway.php @@ -41,12 +41,7 @@ use Zend\ServiceManager\ServiceLocatorAwareInterface, class ServiceLocatorAwareGateway extends RowGateway implements ServiceLocatorAwareInterface { - /** - * Service locator - * - * @var ServiceLocatorInterface - */ - protected $serviceLocator; + use \Zend\ServiceManager\ServiceLocatorAwareTrait; /** * Get access to another table. @@ -59,27 +54,4 @@ class ServiceLocatorAwareGateway extends RowGateway { return $this->getServiceLocator()->get($table); } - - /** - * Set the service locator. - * - * @param ServiceLocatorInterface $serviceLocator Locator to register - * - * @return ServiceLocatorAwareGateway - */ - public function setServiceLocator(ServiceLocatorInterface $serviceLocator) - { - $this->serviceLocator = $serviceLocator; - return $this; - } - - /** - * Get the service locator. - * - * @return \Zend\ServiceManager\ServiceLocatorInterface - */ - public function getServiceLocator() - { - return $this->serviceLocator; - } } diff --git a/module/VuFind/src/VuFind/Db/Table/Gateway.php b/module/VuFind/src/VuFind/Db/Table/Gateway.php index 5b0c481ffc702f7158b717176919fb623a77f1a4..d1d314c0658432ce2e2181312d81cfa97e1b891b 100644 --- a/module/VuFind/src/VuFind/Db/Table/Gateway.php +++ b/module/VuFind/src/VuFind/Db/Table/Gateway.php @@ -42,6 +42,8 @@ use Zend\Db\TableGateway\AbstractTableGateway, */ class Gateway extends AbstractTableGateway implements ServiceLocatorAwareInterface { + use \Zend\ServiceManager\ServiceLocatorAwareTrait; + /** * Name of class used to represent rows (null for default) * @@ -49,13 +51,6 @@ class Gateway extends AbstractTableGateway implements ServiceLocatorAwareInterfa */ protected $rowClass = null; - /** - * Service locator - * - * @var ServiceLocatorInterface - */ - protected $serviceLocator; - /** * Constructor * @@ -160,27 +155,4 @@ class Gateway extends AbstractTableGateway implements ServiceLocatorAwareInterfa { return $this->getServiceLocator()->get($table); } - - /** - * Set the service locator. - * - * @param ServiceLocatorInterface $serviceLocator Locator to register - * - * @return Gateway - */ - public function setServiceLocator(ServiceLocatorInterface $serviceLocator) - { - $this->serviceLocator = $serviceLocator; - return $this; - } - - /** - * Get the service locator. - * - * @return \Zend\ServiceManager\ServiceLocatorInterface - */ - public function getServiceLocator() - { - return $this->serviceLocator; - } } diff --git a/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php b/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php index 91cf00ebe7621c95cf9005cde6ec2e69856f1e54..c58948ca52028d67c8c660701023d2da66f25ae4 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php +++ b/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php @@ -48,12 +48,7 @@ use VuFind\Exception\ILS as ILSException, class MultiBackend extends AbstractBase implements ServiceLocatorAwareInterface, \Zend\Log\LoggerAwareInterface { - /** - * The serviceLocator instance (implementing ServiceLocatorAwareInterface). - * - * @var object - */ - protected $serviceLocator; + use \Zend\ServiceManager\ServiceLocatorAwareTrait; /** * The array of configured driver names. @@ -179,29 +174,6 @@ class MultiBackend extends AbstractBase : '.'; } - /** - * Set the service locator. - * - * @param ServiceLocatorInterface $serviceLocator Locator to register - * - * @return Manager - */ - public function setServiceLocator(ServiceLocatorInterface $serviceLocator) - { - $this->serviceLocator = $serviceLocator; - return $this; - } - - /** - * Get the service locator. - * - * @return \Zend\ServiceManager\ServiceLocatorInterface - */ - public function getServiceLocator() - { - return $this->serviceLocator; - } - /** * Get Status * diff --git a/module/VuFind/src/VuFind/ILS/Driver/Symphony.php b/module/VuFind/src/VuFind/ILS/Driver/Symphony.php index 7e3e58393efb19e2c9210c8cf9effae71f4219c0..c49cae17bc9a0b109e909c78bfb07023552a7e1b 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Symphony.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Symphony.php @@ -46,6 +46,8 @@ use Zend\Log\LoggerInterface, Zend\Log\LoggerAwareInterface; class Symphony extends AbstractBase implements ServiceLocatorAwareInterface, LoggerAwareInterface { + use \Zend\ServiceManager\ServiceLocatorAwareTrait; + /** * Cache for policy information * @@ -60,13 +62,6 @@ class Symphony extends AbstractBase */ protected $policies; - /** - * Service locator - * - * @var ServiceLocatorInterface - */ - protected $serviceLocator; - /** * Logger (or false for none) * @@ -1730,27 +1725,4 @@ class Symphony extends AbstractBase return $libraries[0]['locationID']; } } - - /** - * Set the service locator. - * - * @param ServiceLocatorInterface $serviceLocator Locator to register - * - * @return Symphony - */ - public function setServiceLocator(ServiceLocatorInterface $serviceLocator) - { - $this->serviceLocator = $serviceLocator; - return $this; - } - - /** - * Get the service locator. - * - * @return \Zend\ServiceManager\ServiceLocatorInterface - */ - public function getServiceLocator() - { - return $this->serviceLocator; - } } diff --git a/module/VuFind/src/VuFind/Log/Logger.php b/module/VuFind/src/VuFind/Log/Logger.php index d048847c7425ec434a8d83c90fbc45c7123706c4..084bc96be2fa5cd9a0001b08a97817743239acc4 100644 --- a/module/VuFind/src/VuFind/Log/Logger.php +++ b/module/VuFind/src/VuFind/Log/Logger.php @@ -41,6 +41,8 @@ use Zend\Log\Logger as BaseLogger, */ class Logger extends BaseLogger implements ServiceLocatorAwareInterface { + use \Zend\ServiceManager\ServiceLocatorAwareTrait; + /** * Is debug logging enabled? * @@ -48,13 +50,6 @@ class Logger extends BaseLogger implements ServiceLocatorAwareInterface */ protected $debugNeeded = false; - /** - * Service locator - * - * @var ServiceLocatorInterface - */ - protected $serviceLocator; - /** * Set configuration * @@ -228,29 +223,6 @@ class Logger extends BaseLogger implements ServiceLocatorAwareInterface return $this->debugNeeded; } - /** - * Set the service locator. - * - * @param ServiceLocatorInterface $serviceLocator Locator to register - * - * @return Logger - */ - public function setServiceLocator(ServiceLocatorInterface $serviceLocator) - { - $this->serviceLocator = $serviceLocator; - return $this; - } - - /** - * Get the service locator. - * - * @return \Zend\ServiceManager\ServiceLocatorInterface - */ - public function getServiceLocator() - { - return $this->serviceLocator; - } - /** * Add a message as a log entry * diff --git a/module/VuFind/src/VuFind/Search/Base/Params.php b/module/VuFind/src/VuFind/Search/Base/Params.php index 6c4b90b5043786c28dacef405e7b898a6d3ee92a..2affc69cf13d09d964f7657b8800d13d46275720 100644 --- a/module/VuFind/src/VuFind/Search/Base/Params.php +++ b/module/VuFind/src/VuFind/Search/Base/Params.php @@ -44,6 +44,10 @@ use VuFind\Search\QueryAdapter, VuFind\Solr\Utils as SolrUtils; */ class Params implements ServiceLocatorAwareInterface { + use \Zend\ServiceManager\ServiceLocatorAwareTrait { + setServiceLocator as setServiceLocatorThroughTrait; + } + /** * Internal representation of user query. * @@ -154,13 +158,6 @@ class Params implements ServiceLocatorAwareInterface */ protected $overrideQuery = false; - /** - * Service locator - * - * @var ServiceLocatorInterface - */ - protected $serviceLocator; - /** * Are default filters applied? * @@ -1663,18 +1660,7 @@ class Params implements ServiceLocatorAwareInterface if ($serviceLocator instanceof ServiceLocatorAwareInterface) { $serviceLocator = $serviceLocator->getServiceLocator(); } - $this->serviceLocator = $serviceLocator; - return $this; - } - - /** - * Get the service locator. - * - * @return \Zend\ServiceManager\ServiceLocatorInterface - */ - public function getServiceLocator() - { - return $this->serviceLocator; + return $this->setServiceLocatorThroughTrait($serviceLocator); } /** diff --git a/module/VuFind/src/VuFind/Search/Base/Results.php b/module/VuFind/src/VuFind/Search/Base/Results.php index a2d283b8e277f3a9e57921933655214fae1d6952..e7b73aa48ee04e319a6781410bc5c8c9f8e51e77 100644 --- a/module/VuFind/src/VuFind/Search/Base/Results.php +++ b/module/VuFind/src/VuFind/Search/Base/Results.php @@ -44,6 +44,10 @@ use VuFindSearch\Service as SearchService; */ abstract class Results implements ServiceLocatorAwareInterface { + use \Zend\ServiceManager\ServiceLocatorAwareTrait { + setServiceLocator as setServiceLocatorThroughTrait; + } + /** * Search parameters * @@ -129,13 +133,6 @@ abstract class Results implements ServiceLocatorAwareInterface */ protected $searchService; - /** - * Service locator - * - * @var ServiceLocatorInterface - */ - protected $serviceLocator; - /** * Constructor * @@ -526,8 +523,7 @@ abstract class Results implements ServiceLocatorAwareInterface if ($serviceLocator instanceof ServiceLocatorAwareInterface) { $serviceLocator = $serviceLocator->getServiceLocator(); } - $this->serviceLocator = $serviceLocator; - return $this; + return $this->setServiceLocatorThroughTrait($serviceLocator); } /** @@ -566,16 +562,6 @@ abstract class Results implements ServiceLocatorAwareInterface return $vars; } - /** - * Get the service locator. - * - * @return \Zend\ServiceManager\ServiceLocatorInterface - */ - public function getServiceLocator() - { - return $this->serviceLocator; - } - /** * Return search service. * diff --git a/module/VuFind/src/VuFind/XSLT/Importer.php b/module/VuFind/src/VuFind/XSLT/Importer.php index 3a2e437f16ebd6cab2ef146425ba4923c10ee1d5..972ce8d8ed99e088924987dbb94776bf08db57b4 100644 --- a/module/VuFind/src/VuFind/XSLT/Importer.php +++ b/module/VuFind/src/VuFind/XSLT/Importer.php @@ -43,12 +43,7 @@ use DOMDocument, VuFind\Config\Locator as ConfigLocator, */ class Importer implements ServiceLocatorAwareInterface { - /** - * Service locator - * - * @var ServiceLocatorInterface - */ - protected $serviceLocator; + use \Zend\ServiceManager\ServiceLocatorAwareTrait; /** * Save an XML file to the Solr index using the specified configuration. @@ -191,27 +186,4 @@ class Importer implements ServiceLocatorAwareInterface return $xsl; } - - /** - * Set the service locator. - * - * @param ServiceLocatorInterface $serviceLocator Locator to register - * - * @return Manager - */ - public function setServiceLocator(ServiceLocatorInterface $serviceLocator) - { - $this->serviceLocator = $serviceLocator; - return $this; - } - - /** - * Get the service locator. - * - * @return \Zend\ServiceManager\ServiceLocatorInterface - */ - public function getServiceLocator() - { - return $this->serviceLocator; - } }