Skip to content
Snippets Groups Projects
Commit a07a5ee0 authored by Demian Katz's avatar Demian Katz
Browse files

Give Solr connection access to the service locator.

parent 6880573e
No related merge requests found
...@@ -113,6 +113,9 @@ class Manager ...@@ -113,6 +113,9 @@ class Manager
$index = new $class($url, $core); $index = new $class($url, $core);
} }
// Set the service locator:
$index->setServiceLocator(self::$serviceLocator);
return $index; return $index;
} }
} }
...@@ -29,10 +29,10 @@ ...@@ -29,10 +29,10 @@
namespace VuFind\Connection; namespace VuFind\Connection;
use VuFind\Config\Reader as ConfigReader, use VuFind\Config\Reader as ConfigReader,
VuFind\Db\Table\ChangeTracker as ChangeTrackerTable, VuFind\Db\Table\ChangeTracker as ChangeTrackerTable,
VuFind\Exception\Solr as SolrException, VuFind\Exception\Solr as SolrException, VuFind\Http\Client as HttpClient,
VuFind\Http\Client as HttpClient, VuFind\Log\Logger, VuFind\Solr\Utils as SolrUtils,
VuFind\Log\Logger, Zend\ServiceManager\ServiceLocatorAwareInterface,
VuFind\Solr\Utils as SolrUtils; Zend\ServiceManager\ServiceLocatorInterface;
/** /**
* Solr HTTP Interface * Solr HTTP Interface
...@@ -43,7 +43,7 @@ use VuFind\Config\Reader as ConfigReader, ...@@ -43,7 +43,7 @@ use VuFind\Config\Reader as ConfigReader,
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org/wiki/system_classes#index_interface Wiki * @link http://vufind.org/wiki/system_classes#index_interface Wiki
*/ */
class Solr class Solr implements ServiceLocatorAwareInterface
{ {
/** /**
* A boolean value determining whether to print debug information * A boolean value determining whether to print debug information
...@@ -128,6 +128,13 @@ class Solr ...@@ -128,6 +128,13 @@ class Solr
*/ */
protected $solrSearchParams; protected $solrSearchParams;
/**
* Service locator
*
* @var ServiceLocatorInterface
*/
protected $serviceLocator;
/** /**
* Constructor * Constructor
* *
...@@ -1712,4 +1719,27 @@ class Solr ...@@ -1712,4 +1719,27 @@ class Solr
$config = ConfigReader::getConfig(); $config = ConfigReader::getConfig();
return isset($config->Index->timeout) ? $config->Index->timeout : 30; return isset($config->Index->timeout) ? $config->Index->timeout : 30;
} }
/**
* Set the service locator.
*
* @param ServiceLocatorInterface $serviceLocator Locator to register
*
* @return Solr
*/
public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
{
$this->serviceLocator = $serviceLocator;
return $this;
}
/**
* Get the service locator.
*
* @return \Zend\ServiceManager\ServiceLocatorInterface
*/
public function getServiceLocator()
{
return $this->serviceLocator;
}
} }
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment