From 406888629bece559693920167c207d5064e9462d Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Mon, 11 Mar 2013 11:14:26 -0400
Subject: [PATCH] Fixed bugs related to moving logic from __construct() to
 init().

---
 .../src/VuFind/Search/SolrAuth/Options.php       | 16 +++++++++++++---
 .../src/VuFind/Search/SolrAuthor/Options.php     | 12 +++++++-----
 .../VuFind/Search/SolrAuthorFacets/Options.php   | 12 +++++++-----
 .../src/VuFind/Search/SolrReserves/Options.php   | 16 +++++++++++++---
 .../VuFind/src/VuFind/Search/Summon/Options.php  |  1 +
 module/VuFind/src/VuFind/Search/Tags/Options.php | 10 +++++-----
 .../src/VuFind/Search/WorldCat/Options.php       |  1 +
 7 files changed, 47 insertions(+), 21 deletions(-)

diff --git a/module/VuFind/src/VuFind/Search/SolrAuth/Options.php b/module/VuFind/src/VuFind/Search/SolrAuth/Options.php
index 456536eefab..50446c243f7 100644
--- a/module/VuFind/src/VuFind/Search/SolrAuth/Options.php
+++ b/module/VuFind/src/VuFind/Search/SolrAuth/Options.php
@@ -26,7 +26,6 @@
  * @link     http://www.vufind.org  Main Page
  */
 namespace VuFind\Search\SolrAuth;
-use VuFind\Search\Solr\Options as SolrOptions;
 
 /**
  * Solr Authority Search Options
@@ -37,7 +36,7 @@ use VuFind\Search\Solr\Options as SolrOptions;
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
  * @link     http://www.vufind.org  Main Page
  */
-class Options extends SolrOptions
+class Options extends \VuFind\Search\Solr\Options
 {
     /**
      * Constructor
@@ -46,8 +45,19 @@ class Options extends SolrOptions
      */
     public function __construct()
     {
-        $this->facetsIni = $this->searchIni = 'authority';
         parent::__construct();
+        $this->facetsIni = $this->searchIni = 'authority';
+    }
+
+    /**
+     * Perform initialization that cannot occur in constructor due to need for
+     * injected dependencies.
+     *
+     * @return void
+     */
+    public function init()
+    {
+        parent::init();
         $this->spellcheck = false;
     }
 
diff --git a/module/VuFind/src/VuFind/Search/SolrAuthor/Options.php b/module/VuFind/src/VuFind/Search/SolrAuthor/Options.php
index 1f87ca1a61b..8fdba2ca3ac 100644
--- a/module/VuFind/src/VuFind/Search/SolrAuthor/Options.php
+++ b/module/VuFind/src/VuFind/Search/SolrAuthor/Options.php
@@ -26,7 +26,6 @@
  * @link     http://vufind.org   Main Site
  */
 namespace VuFind\Search\SolrAuthor;
-use VuFind\Search\Solr\Options as SolrOptions;
 
 /**
  * Author Search Options
@@ -37,14 +36,17 @@ use VuFind\Search\Solr\Options as SolrOptions;
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
  * @link     http://vufind.org   Main Site
  */
-class Options extends SolrOptions
+class Options extends \VuFind\Search\Solr\Options
 {
     /**
-     * Constructor
+     * Perform initialization that cannot occur in constructor due to need for
+     * injected dependencies.
+     *
+     * @return void
      */
-    public function __construct()
+    public function init()
     {
-        parent::__construct();
+        parent::init();
 
         // No spell check needed in author module:
         $this->spellcheck = false;
diff --git a/module/VuFind/src/VuFind/Search/SolrAuthorFacets/Options.php b/module/VuFind/src/VuFind/Search/SolrAuthorFacets/Options.php
index 228616362d2..029b41d7169 100644
--- a/module/VuFind/src/VuFind/Search/SolrAuthorFacets/Options.php
+++ b/module/VuFind/src/VuFind/Search/SolrAuthorFacets/Options.php
@@ -26,7 +26,6 @@
  * @link     http://vufind.org   Main Site
  */
 namespace VuFind\Search\SolrAuthorFacets;
-use VuFind\Search\Solr\Options as SolrOptions;
 
 /**
  * AuthorFacets Search Options
@@ -37,14 +36,17 @@ use VuFind\Search\Solr\Options as SolrOptions;
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
  * @link     http://vufind.org   Main Site
  */
-class Options extends SolrOptions
+class Options extends \VuFind\Search\Solr\Options
 {
     /**
-     * Constructor
+     * Perform initialization that cannot occur in constructor due to need for
+     * injected dependencies.
+     *
+     * @return void
      */
-    public function __construct()
+    public function init()
     {
-        parent::__construct();
+        parent::init();
 
         // Special sort options...
         // It's important to remember here we are talking about on-screen
diff --git a/module/VuFind/src/VuFind/Search/SolrReserves/Options.php b/module/VuFind/src/VuFind/Search/SolrReserves/Options.php
index 897dc4b76f2..9a011161e3c 100644
--- a/module/VuFind/src/VuFind/Search/SolrReserves/Options.php
+++ b/module/VuFind/src/VuFind/Search/SolrReserves/Options.php
@@ -27,7 +27,6 @@
  * @link     http://www.vufind.org  Main Page
  */
 namespace VuFind\Search\SolrReserves;
-use VuFind\Search\Solr\Options as SolrOptions;
 
 /**
  * Solr Reserves Search Options
@@ -39,7 +38,7 @@ use VuFind\Search\Solr\Options as SolrOptions;
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
  * @link     http://www.vufind.org  Main Page
  */
-class Options extends SolrOptions
+class Options extends \VuFind\Search\Solr\Options
 {
     /**
      * Constructor
@@ -48,8 +47,19 @@ class Options extends SolrOptions
      */
     public function __construct()
     {
-        $this->facetsIni = $this->searchIni = 'reserves';
         parent::__construct();
+        $this->facetsIni = $this->searchIni = 'reserves';
+    }
+
+    /**
+     * Perform initialization that cannot occur in constructor due to need for
+     * injected dependencies.
+     *
+     * @return void
+     */
+    public function init()
+    {
+        parent::init();
         $this->spellcheck = false;
     }
 
diff --git a/module/VuFind/src/VuFind/Search/Summon/Options.php b/module/VuFind/src/VuFind/Search/Summon/Options.php
index 83d39b38721..e25bab17478 100644
--- a/module/VuFind/src/VuFind/Search/Summon/Options.php
+++ b/module/VuFind/src/VuFind/Search/Summon/Options.php
@@ -52,6 +52,7 @@ class Options extends \VuFind\Search\Base\Options
      */
     public function __construct()
     {
+        parent::__construct();
         $this->searchIni = $this->facetsIni = 'Summon';
     }
 
diff --git a/module/VuFind/src/VuFind/Search/Tags/Options.php b/module/VuFind/src/VuFind/Search/Tags/Options.php
index 940b1a17858..cbcf7b05cc8 100644
--- a/module/VuFind/src/VuFind/Search/Tags/Options.php
+++ b/module/VuFind/src/VuFind/Search/Tags/Options.php
@@ -26,7 +26,6 @@
  * @link     http://vufind.org   Main Site
  */
 namespace VuFind\Search\Tags;
-use VuFind\Search\Base\Options as BaseOptions;
 
 /**
  * Search Tags Options
@@ -37,16 +36,17 @@ use VuFind\Search\Base\Options as BaseOptions;
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
  * @link     http://vufind.org   Main Site
  */
-class Options extends BaseOptions
+class Options extends \VuFind\Search\Base\Options
 {
     /**
-     * Constructor
+     * Perform initialization that cannot occur in constructor due to need for
+     * injected dependencies.
      *
      * @return void
      */
-    public function __construct()
+    public function init()
     {
-        parent::__construct();
+        parent::init();
         $this->basicHandlers = array('tags' => 'Tag');
         $this->defaultSort = 'title';
         $this->sortOptions = array(
diff --git a/module/VuFind/src/VuFind/Search/WorldCat/Options.php b/module/VuFind/src/VuFind/Search/WorldCat/Options.php
index ee7246b9c52..e0b105f7bcf 100644
--- a/module/VuFind/src/VuFind/Search/WorldCat/Options.php
+++ b/module/VuFind/src/VuFind/Search/WorldCat/Options.php
@@ -45,6 +45,7 @@ class Options extends \VuFind\Search\Base\Options
      */
     public function __construct()
     {
+        parent::__construct();
         $this->searchIni = $this->facetsIni = 'WorldCat';
     }
 
-- 
GitLab