From 7856fb3a2c7ea79e6e6fc24cf04ea57a7ff98ffd Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Fri, 1 Mar 2013 09:22:50 -0500 Subject: [PATCH] Inject configuration. --- .../src/VuFind/Connection/Summon/Query.php | 16 +++++++++++----- .../VuFind/src/VuFind/Search/Summon/Results.php | 3 ++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/module/VuFind/src/VuFind/Connection/Summon/Query.php b/module/VuFind/src/VuFind/Connection/Summon/Query.php index c0326788a96..b7f490ebf55 100644 --- a/module/VuFind/src/VuFind/Connection/Summon/Query.php +++ b/module/VuFind/src/VuFind/Connection/Summon/Query.php @@ -27,7 +27,7 @@ * @link http://api.summon.serialssolutions.com/help/api/ API Documentation */ namespace VuFind\Connection\Summon; -use VuFind\Config\Reader as ConfigReader, VuFind\Solr\Utils as SolrUtils; +use VuFind\Solr\Utils as SolrUtils; /** * Summon REST API Interface (query model - VuFind implementation) @@ -41,6 +41,11 @@ use VuFind\Config\Reader as ConfigReader, VuFind\Solr\Utils as SolrUtils; */ class Query extends \SerialsSolutions_Summon_Query { + /** + * Summon configuration object + * + * @var \Zend\Config\Config + */ protected $config; /** @@ -48,13 +53,14 @@ class Query extends \SerialsSolutions_Summon_Query * * Sets up the Summon API Client * - * @param string $query Search query - * @param array $options Other options to set (associative array) + * @param string $query Search query + * @param array $options Other options to set (associative array) + * @param \Zend\Config\Config $config Summon configuration object (optional) */ - public function __construct($query = null, $options = array()) + public function __construct($query = null, $options = array(), $config = null) { parent::__construct($query, $options); - $this->config = ConfigReader::getConfig('Summon'); + $this->config = $config; } /** diff --git a/module/VuFind/src/VuFind/Search/Summon/Results.php b/module/VuFind/src/VuFind/Search/Summon/Results.php index 0573eacdce7..e00221b5d71 100644 --- a/module/VuFind/src/VuFind/Search/Summon/Results.php +++ b/module/VuFind/src/VuFind/Search/Summon/Results.php @@ -93,7 +93,8 @@ class Results extends BaseResults 'pageNumber' => $this->getParams()->getPage(), 'pageSize' => $this->getParams()->getLimit(), 'didYouMean' => $this->getOptions()->spellcheckEnabled() - ) + ), + $this->getServiceLocator()->get('VuFind\Config')->get('Summon') ); if ($this->getOptions()->highlightEnabled()) { $query->setHighlight(true); -- GitLab