From c047a9091b412572a8bc6036a95bb9950cde35a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Samuli=20Sillanp=C3=A4=C3=A4?=
 <samuli.sillanpaa@helsinki.fi>
Date: Fri, 1 Nov 2019 12:44:17 -0400
Subject: [PATCH] Improve extensibility of code. - Use properties to allow
 subclass overrides.

---
 module/VuFind/src/VuFind/RecordTab/CollectionList.php  |  9 ++++++++-
 .../Search/Factory/SolrDefaultBackendFactory.php       | 10 +++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/module/VuFind/src/VuFind/RecordTab/CollectionList.php b/module/VuFind/src/VuFind/RecordTab/CollectionList.php
index 31b29c4b5f0..6656f0d73ee 100644
--- a/module/VuFind/src/VuFind/RecordTab/CollectionList.php
+++ b/module/VuFind/src/VuFind/RecordTab/CollectionList.php
@@ -63,6 +63,13 @@ class CollectionList extends AbstractBase
      */
     protected $recommendManager;
 
+    /**
+     * Search class id
+     *
+     * @var string
+     */
+    protected $searchClassId = 'SolrCollection';
+
     /**
      * Constructor
      *
@@ -116,7 +123,7 @@ class CollectionList extends AbstractBase
                 $listener->attach($runner->getEventManager()->getSharedManager());
             };
             $this->results
-                = $this->runner->run($request, 'SolrCollection', $cb);
+                = $this->runner->run($request, $this->searchClassId, $cb);
         }
         return $this->results;
     }
diff --git a/module/VuFind/src/VuFind/Search/Factory/SolrDefaultBackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/SolrDefaultBackendFactory.php
index 55f9cd0cabd..5d9b2232ae4 100644
--- a/module/VuFind/src/VuFind/Search/Factory/SolrDefaultBackendFactory.php
+++ b/module/VuFind/src/VuFind/Search/Factory/SolrDefaultBackendFactory.php
@@ -43,6 +43,13 @@ use VuFindSearch\Backend\Solr\Response\Json\RecordCollectionFactory;
  */
 class SolrDefaultBackendFactory extends AbstractSolrBackendFactory
 {
+    /**
+     * Method for creating a record driver.
+     *
+     * @var string
+     */
+    protected $createRecordMethod = 'getSolrRecord';
+
     /**
      * Constructor
      */
@@ -78,7 +85,8 @@ class SolrDefaultBackendFactory extends AbstractSolrBackendFactory
         $backend = parent::createBackend($connector);
         $manager = $this->serviceLocator
             ->get(\VuFind\RecordDriver\PluginManager::class);
-        $factory = new RecordCollectionFactory([$manager, 'getSolrRecord']);
+        $factory
+            = new RecordCollectionFactory([$manager, $this->createRecordMethod]);
         $backend->setRecordCollectionFactory($factory);
         return $backend;
     }
-- 
GitLab