From f2437f5d466acf8c7a2b61cb928a5186a3c0a6d9 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Tue, 4 Sep 2012 15:17:15 -0400
Subject: [PATCH] Refactored VuFind\Record into VuFind\Record\Loader and
 VuFind\Record\Router for better granularity.

---
 module/VuFind/src/VuFind/Cart.php             |   5 +-
 .../src/VuFind/Controller/AbstractRecord.php  |   5 +-
 .../src/VuFind/Controller/AbstractSearch.php  |   7 +-
 .../src/VuFind/Controller/AjaxController.php  |  13 +-
 .../src/VuFind/Controller/CartController.php  |  14 +--
 .../Controller/MyResearchController.php       |   9 +-
 .../VuFind/Controller/RecordsController.php   |   4 +-
 .../VuFind/Controller/UpgradeController.php   |   6 +-
 .../VuFind/src/VuFind/Db/Table/Resource.php   |   4 +-
 .../VuFind/{Record.php => Record/Loader.php}  |  81 +-----------
 module/VuFind/src/VuFind/Record/Router.php    | 117 ++++++++++++++++++
 .../VuFind/src/VuFind/Search/Base/Results.php |   4 +-
 .../src/VuFind/Search/Favorites/Results.php   |   4 +-
 .../src/VuFind/Search/MixedList/Results.php   |   4 +-
 .../VuFind/src/VuFind/Search/Tags/Results.php |   4 +-
 .../VuFind/Theme/Root/Helper/RecordLink.php   |   6 +-
 16 files changed, 166 insertions(+), 121 deletions(-)
 rename module/VuFind/src/VuFind/{Record.php => Record/Loader.php} (65%)
 create mode 100644 module/VuFind/src/VuFind/Record/Router.php

diff --git a/module/VuFind/src/VuFind/Cart.php b/module/VuFind/src/VuFind/Cart.php
index 73b2d5107de..99d78b6f426 100644
--- a/module/VuFind/src/VuFind/Cart.php
+++ b/module/VuFind/src/VuFind/Cart.php
@@ -26,8 +26,7 @@
  * @link     http://vufind.org/wiki/system_classes Wiki
  */
 namespace VuFind;
-use VuFind\Config\Reader as ConfigReader;
-use VuFind\Record;
+use VuFind\Config\Reader as ConfigReader, VuFind\Record\Loader as RecordLoader;
 
 /**
  * Cart Class
@@ -268,6 +267,6 @@ class Cart
      */
     public function getRecordDetails()
     {
-        return Record::loadBatch($this->items);
+        return RecordLoader::loadBatch($this->items);
     }
 }
diff --git a/module/VuFind/src/VuFind/Controller/AbstractRecord.php b/module/VuFind/src/VuFind/Controller/AbstractRecord.php
index 80b684d4a5d..f1c2d39f240 100644
--- a/module/VuFind/src/VuFind/Controller/AbstractRecord.php
+++ b/module/VuFind/src/VuFind/Controller/AbstractRecord.php
@@ -29,7 +29,8 @@ namespace VuFind\Controller;
 use VuFind\Db\Table\Comments as CommentsTable,
     VuFind\Db\Table\Resource as ResourceTable,
     VuFind\Exception\Mail as MailException, VuFind\Export, VuFind\Mailer,
-    VuFind\Mailer\SMS, VuFind\Record, Zend\Session\Container as SessionContainer;
+    VuFind\Mailer\SMS, VuFind\Record\Router as RecordRouter,
+    Zend\Session\Container as SessionContainer;
 
 /**
  * VuFind Record Controller
@@ -477,7 +478,7 @@ class AbstractRecord extends AbstractBase
      */
     protected function redirectToRecord($params = '', $tab = null)
     {
-        $details = Record::getTabRouteDetails($this->loadRecord(), $tab);
+        $details = RecordRouter::getTabRouteDetails($this->loadRecord(), $tab);
         $target = $this->url()->fromRoute($details['route'], $details['params']);
         return $this->redirect()->toUrl($target . $params);
     }
diff --git a/module/VuFind/src/VuFind/Controller/AbstractSearch.php b/module/VuFind/src/VuFind/Controller/AbstractSearch.php
index 7159b279b98..702a1160142 100644
--- a/module/VuFind/src/VuFind/Controller/AbstractSearch.php
+++ b/module/VuFind/src/VuFind/Controller/AbstractSearch.php
@@ -26,8 +26,9 @@
  * @link     http://www.vufind.org  Main Page
  */
 namespace VuFind\Controller;
-use VuFind\Db\Table\Search as SearchTable, VuFind\Record, VuFind\Search\Memory,
-    VuFind\Search\Options as SearchOptions, Zend\Stdlib\Parameters;
+use VuFind\Db\Table\Search as SearchTable, VuFind\Record\Router as RecordRouter,
+    VuFind\Search\Memory, VuFind\Search\Options as SearchOptions,
+    Zend\Stdlib\Parameters;
 
 /**
  * VuFind Search Controller
@@ -259,7 +260,7 @@ class AbstractSearch extends AbstractBase
 
         // If we got this far, we have a valid parameter so we should redirect
         // and report success:
-        $details = Record::getTabRouteDetails($recordList[$jumpto - 1]);
+        $details = RecordRouter::getTabRouteDetails($recordList[$jumpto - 1]);
         return $this->redirect()->toRoute($details['route'], $details['params']);
     }
 
diff --git a/module/VuFind/src/VuFind/Controller/AjaxController.php b/module/VuFind/src/VuFind/Controller/AjaxController.php
index 7fe6223f5f8..916423edf97 100644
--- a/module/VuFind/src/VuFind/Controller/AjaxController.php
+++ b/module/VuFind/src/VuFind/Controller/AjaxController.php
@@ -32,7 +32,8 @@ use VuFind\Config\Reader as ConfigReader,
     VuFind\Db\Table\Resource as ResourceTable, VuFind\Db\Table\Tags as TagsTable,
     VuFind\Db\Table\UserList as UserListTable,
     VuFind\Exception\Auth as AuthException, VuFind\Export, VuFind\Mailer,
-    VuFind\Mailer\SMS, VuFind\Record, VuFind\Translator\Translator;
+    VuFind\Mailer\SMS, VuFind\Record\Loader as RecordLoader,
+    VuFind\Translator\Translator;
 
 /**
  * This controller handles global AJAX functionality
@@ -606,7 +607,7 @@ class AjaxController extends AbstractBase
         }
         // empty tag
         try {
-            $driver = Record::load(
+            $driver = RecordLoader::load(
                 $this->params()->fromPost('id'),
                 $this->params()->fromPost('source', 'VuFind')
             );
@@ -826,7 +827,7 @@ class AjaxController extends AbstractBase
             );
         }
 
-        $driver = Record::load(
+        $driver = RecordLoader::load(
             $this->params()->fromPost('id'),
             $this->params()->fromPost('source', 'VuFind')
         );
@@ -933,7 +934,7 @@ class AjaxController extends AbstractBase
     {
         // Attempt to send the email:
         try {
-            $record = Record::load(
+            $record = RecordLoader::load(
                 $this->params()->fromPost('id'),
                 $this->params()->fromPost('source', 'VuFind')
             );
@@ -962,7 +963,7 @@ class AjaxController extends AbstractBase
     {
         // Attempt to send the email:
         try {
-            $record = Record::load(
+            $record = RecordLoader::load(
                 $this->params()->fromPost('id'),
                 $this->params()->fromPost('source', 'VuFind')
             );
@@ -1122,7 +1123,7 @@ class AjaxController extends AbstractBase
      */
     public function getRecordCommentsAsHTML()
     {
-        $driver = Record::load(
+        $driver = RecordLoader::load(
             $this->params()->fromQuery('id'),
             $this->params()->fromQuery('source', 'VuFind')
         );
diff --git a/module/VuFind/src/VuFind/Controller/CartController.php b/module/VuFind/src/VuFind/Controller/CartController.php
index 8f3280ff842..d8bd06bfc75 100644
--- a/module/VuFind/src/VuFind/Controller/CartController.php
+++ b/module/VuFind/src/VuFind/Controller/CartController.php
@@ -26,9 +26,9 @@
  * @link     http://vufind.org   Main Site
  */
 namespace VuFind\Controller;
-use VuFind\Exception\Mail as MailException, VuFind\Export,
-    VuFind\Mailer, VuFind\Record, VuFind\Translator\Translator,
-    Zend\Session\Container as SessionContainer;
+use VuFind\Exception\Mail as MailException, VuFind\Export, VuFind\Mailer,
+    VuFind\Record\Loader as RecordLoader,
+    VuFind\Translator\Translator, Zend\Session\Container as SessionContainer;
 
 /**
  * Book Bag / Bulk Action Controller
@@ -174,7 +174,7 @@ class CartController extends AbstractBase
             return $this->redirectToSource('error', 'bulk_noitems_advice');
         }
         $view = $this->createViewModel();
-        $view->records = Record::loadBatch($ids);
+        $view->records = RecordLoader::loadBatch($ids);
 
         // Process form submission:
         if ($this->params()->fromPost('submit')) {
@@ -258,7 +258,7 @@ class CartController extends AbstractBase
 
         // Load the records:
         $view = $this->createViewModel();
-        $view->records = Record::loadBatch($ids);
+        $view->records = RecordLoader::loadBatch($ids);
 
         // Assign the list of legal export options.  We'll filter them down based
         // on what the selected records actually support.
@@ -305,7 +305,7 @@ class CartController extends AbstractBase
 
 
         // Actually export the records
-        $records = Record::loadBatch($ids);
+        $records = RecordLoader::loadBatch($ids);
         $recordHelper = $this->getViewRenderer()->plugin('record');
         $parts = array();
         foreach ($records as $record) {
@@ -356,7 +356,7 @@ class CartController extends AbstractBase
         // Pass record and list information to view:
         return $this->createViewModel(
             array(
-                'records' => Record::loadBatch($ids),
+                'records' => RecordLoader::loadBatch($ids),
                 'lists' => $user->getLists()
             )
         );
diff --git a/module/VuFind/src/VuFind/Controller/MyResearchController.php b/module/VuFind/src/VuFind/Controller/MyResearchController.php
index ea6408ee614..3e3f8dfccd8 100644
--- a/module/VuFind/src/VuFind/Controller/MyResearchController.php
+++ b/module/VuFind/src/VuFind/Controller/MyResearchController.php
@@ -34,7 +34,8 @@ use VuFind\Config\Reader as ConfigReader,
     VuFind\Exception\Auth as AuthException,
     VuFind\Exception\ListPermission as ListPermissionException,
     VuFind\Exception\RecordMissing as RecordMissingException,
-    VuFind\Record, VuFind\Search\Solr\Results as SolrResults,
+    VuFind\Record\Loader as RecordLoader,
+    VuFind\Record\Router as RecordRouter, VuFind\Search\Solr\Results as SolrResults,
     Zend\Stdlib\Parameters;
 
 /**
@@ -319,7 +320,7 @@ class MyResearchController extends AbstractBase
                 'list' => empty($listID)
                     ? false : UserListTable::getExisting($listID),
                 'deleteIDS' => $ids,
-                'records' => Record::loadBatch($ids)
+                'records' => RecordLoader::loadBatch($ids)
             )
         );
     }
@@ -421,7 +422,7 @@ class MyResearchController extends AbstractBase
         $source = $this->params()->fromPost(
             'source', $this->params()->fromQuery('source', 'VuFind')
         );
-        $driver = Record::load($id, $source);
+        $driver = RecordLoader::load($id, $source);
         $listID = $this->params()->fromPost(
             'list_id', $this->params()->fromQuery('list_id', null)
         );
@@ -575,7 +576,7 @@ class MyResearchController extends AbstractBase
             $recordId = $this->params()->fromQuery('recordId');
             $recordSource = $this->params()->fromQuery('recordSource', 'VuFind');
             if (!empty($recordId)) {
-                $details = Record::getActionRouteDetails(
+                $details = RecordRouter::getActionRouteDetails(
                     $recordSource . '|' . $recordId, 'Save'
                 );
                 return $this->redirect()
diff --git a/module/VuFind/src/VuFind/Controller/RecordsController.php b/module/VuFind/src/VuFind/Controller/RecordsController.php
index 62676691721..41dee21e40f 100644
--- a/module/VuFind/src/VuFind/Controller/RecordsController.php
+++ b/module/VuFind/src/VuFind/Controller/RecordsController.php
@@ -26,7 +26,7 @@
  * @link     http://vufind.org   Main Site
  */
 namespace VuFind\Controller;
-use VuFind\Record;
+use VuFind\Record\Router as RecordRouter;
 
 /**
  * Records Controller
@@ -59,7 +59,7 @@ class RecordsController extends AbstractSearch
         // If there is exactly one record, send the user directly there:
         $ids = $this->params()->fromQuery('id', array());
         if (count($ids) == 1) {
-            $details = Record::getTabRouteDetails($ids[0]);
+            $details = RecordRouter::getTabRouteDetails($ids[0]);
             $target = $this->url()->fromRoute($details['route'], $details['params']);
             // forward print param, if necessary:
             $print = $this->params()->fromQuery('print');
diff --git a/module/VuFind/src/VuFind/Controller/UpgradeController.php b/module/VuFind/src/VuFind/Controller/UpgradeController.php
index 1d58bb960e0..fc68a18ad74 100644
--- a/module/VuFind/src/VuFind/Controller/UpgradeController.php
+++ b/module/VuFind/src/VuFind/Controller/UpgradeController.php
@@ -31,7 +31,8 @@ use ArrayObject, VuFind\Cache\Manager as CacheManager,
     VuFind\Db\AdapterFactory, VuFind\Db\Table\Resource as ResourceTable,
     VuFind\Db\Table\ResourceTags as ResourceTagsTable,
     VuFind\Db\Table\User as UserTable,
-    VuFind\Exception\RecordMissing as RecordMissingException, VuFind\Record,
+    VuFind\Exception\RecordMissing as RecordMissingException,
+    VuFind\Record\Loader as RecordLoader,
     Zend\Db\TableGateway\Feature\GlobalAdapterFeature as DbGlobalAdapter,
     Zend\Session\Container as SessionContainer;
 
@@ -365,7 +366,8 @@ class UpgradeController extends AbstractBase
         if (strlen($this->params()->fromPost('submit', '')) > 0) {
             foreach ($problems as $problem) {
                 try {
-                    $driver = Record::load($problem->record_id, $problem->source);
+                    $driver
+                        = RecordLoader::load($problem->record_id, $problem->source);
                     $problem->assignMetadata($driver)->save();
                 } catch (RecordMissingException $e) {
                     $this->session->warnings->append(
diff --git a/module/VuFind/src/VuFind/Db/Table/Resource.php b/module/VuFind/src/VuFind/Db/Table/Resource.php
index fb5c3e200d7..7181c08b3d0 100644
--- a/module/VuFind/src/VuFind/Db/Table/Resource.php
+++ b/module/VuFind/src/VuFind/Db/Table/Resource.php
@@ -26,7 +26,7 @@
  * @link     http://vufind.org   Main Site
  */
 namespace VuFind\Db\Table;
-use VuFind\Record, Zend\Db\Sql\Expression;
+use VuFind\Record\Loader as RecordLoader, Zend\Db\Sql\Expression;
 
 /**
  * Table Definition for resource
@@ -79,7 +79,7 @@ class Resource extends Gateway
 
             // Load record if it was not provided:
             if (is_null($driver)) {
-                $driver = Record::load($id, $source);
+                $driver = RecordLoader::load($id, $source);
             }
 
             // Load metadata into the database for sorting/failback purposes:
diff --git a/module/VuFind/src/VuFind/Record.php b/module/VuFind/src/VuFind/Record/Loader.php
similarity index 65%
rename from module/VuFind/src/VuFind/Record.php
rename to module/VuFind/src/VuFind/Record/Loader.php
index 2fb8f273d79..63b7b33ece6 100644
--- a/module/VuFind/src/VuFind/Record.php
+++ b/module/VuFind/src/VuFind/Record/Loader.php
@@ -25,7 +25,7 @@
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
  * @link     http://vufind.org   Main Site
  */
-namespace VuFind;
+namespace VuFind\Record;
 
 /**
  * Record loader
@@ -36,7 +36,7 @@ namespace VuFind;
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
  * @link     http://vufind.org   Main Site
  */
-class Record
+class Loader
 {
     /**
      * Given a record source, return the search class that can load that type of
@@ -67,83 +67,6 @@ class Record
         return $class;
     }
 
-    /**
-     * Get routing details for a controller action.
-     *
-     * @param \VuFind\RecordDriver\AbstractBase|string $driver Record driver
-     * representing record to link to, or source|id pipe-delimited string
-     * @param string                                   $action Action to access
-     *
-     * @return array
-     */
-    public static function getActionRouteDetails($driver, $action)
-    {
-        return static::getRouteDetails($driver, '-' . strtolower($action));
-    }
-
-    /**
-     * Get routing details to display a particular tab.
-     *
-     * @param \VuFind\RecordDriver\AbstractBase|string $driver Record driver
-     * representing record to link to, or source|id pipe-delimited string
-     * @param string                                   $tab    Action to access
-     *
-     * @return array
-     */
-    public static function getTabRouteDetails($driver, $tab = null)
-    {
-        return static::getRouteDetails(
-            $driver, '', empty($tab) ? array() : array('tab' => $tab)
-        );
-    }
-
-    /**
-     * Get routing details (route name and parameters array) to link to a record.
-     *
-     * @param \VuFind\RecordDriver\AbstractBase|string $driver      Record driver
-     * representing record to link to, or source|id pipe-delimited string
-     * @param string                                   $routeSuffix Suffix to add
-     * to route name
-     * @param array                                    $extraParams Extra parameters
-     * for route
-     *
-     * @return array
-     */
-    public static function getRouteDetails($driver, $routeSuffix,
-        $extraParams = array()
-    ) {
-        // Extract source and ID from driver or string:
-        if (is_object($driver)) {
-            $source = $driver->getResourceSource();
-            $id = $driver->getUniqueId();
-        } else {
-            $parts = explode('|', $driver, 2);
-            if (count($parts) < 2) {
-                $source = 'VuFind';
-                $id = $parts[0];
-            } else {
-                $source = $parts[0];
-                $id = $parts[1];
-            }
-        }
-
-        // Build URL parameters:
-        $params = $extraParams;
-        $params['id'] = $id;
-        if (!empty($action)) {
-            $params['action'] = $action;
-        }
-
-        // Determine route based on naming convention (default VuFind route is
-        // the exception to the rule):
-        $routeBase = ($source == 'VuFind')
-            ? 'record' : strtolower($source . 'record');
-
-        return array(
-            'params' => $params, 'route' => $routeBase . $routeSuffix
-        );
-    }
-
     /**
      * Given an ID and record source, load the requested record object.
      *
diff --git a/module/VuFind/src/VuFind/Record/Router.php b/module/VuFind/src/VuFind/Record/Router.php
new file mode 100644
index 00000000000..5ac79183c56
--- /dev/null
+++ b/module/VuFind/src/VuFind/Record/Router.php
@@ -0,0 +1,117 @@
+<?php
+/**
+ * Record route generator
+ *
+ * PHP version 5
+ *
+ * Copyright (C) Villanova University 2010.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * @category VuFind2
+ * @package  Record
+ * @author   Demian Katz <demian.katz@villanova.edu>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     http://vufind.org   Main Site
+ */
+namespace VuFind\Record;
+
+/**
+ * Record route generator
+ *
+ * @category VuFind2
+ * @package  Record
+ * @author   Demian Katz <demian.katz@villanova.edu>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     http://vufind.org   Main Site
+ */
+class Router
+{
+    /**
+     * Get routing details for a controller action.
+     *
+     * @param \VuFind\RecordDriver\AbstractBase|string $driver Record driver
+     * representing record to link to, or source|id pipe-delimited string
+     * @param string                                   $action Action to access
+     *
+     * @return array
+     */
+    public static function getActionRouteDetails($driver, $action)
+    {
+        return static::getRouteDetails($driver, '-' . strtolower($action));
+    }
+
+    /**
+     * Get routing details to display a particular tab.
+     *
+     * @param \VuFind\RecordDriver\AbstractBase|string $driver Record driver
+     * representing record to link to, or source|id pipe-delimited string
+     * @param string                                   $tab    Action to access
+     *
+     * @return array
+     */
+    public static function getTabRouteDetails($driver, $tab = null)
+    {
+        return static::getRouteDetails(
+            $driver, '', empty($tab) ? array() : array('tab' => $tab)
+        );
+    }
+
+    /**
+     * Get routing details (route name and parameters array) to link to a record.
+     *
+     * @param \VuFind\RecordDriver\AbstractBase|string $driver      Record driver
+     * representing record to link to, or source|id pipe-delimited string
+     * @param string                                   $routeSuffix Suffix to add
+     * to route name
+     * @param array                                    $extraParams Extra parameters
+     * for route
+     *
+     * @return array
+     */
+    public static function getRouteDetails($driver, $routeSuffix,
+        $extraParams = array()
+    ) {
+        // Extract source and ID from driver or string:
+        if (is_object($driver)) {
+            $source = $driver->getResourceSource();
+            $id = $driver->getUniqueId();
+        } else {
+            $parts = explode('|', $driver, 2);
+            if (count($parts) < 2) {
+                $source = 'VuFind';
+                $id = $parts[0];
+            } else {
+                $source = $parts[0];
+                $id = $parts[1];
+            }
+        }
+
+        // Build URL parameters:
+        $params = $extraParams;
+        $params['id'] = $id;
+        if (!empty($action)) {
+            $params['action'] = $action;
+        }
+
+        // Determine route based on naming convention (default VuFind route is
+        // the exception to the rule):
+        $routeBase = ($source == 'VuFind')
+            ? 'record' : strtolower($source . 'record');
+
+        return array(
+            'params' => $params, 'route' => $routeBase . $routeSuffix
+        );
+    }
+}
diff --git a/module/VuFind/src/VuFind/Search/Base/Results.php b/module/VuFind/src/VuFind/Search/Base/Results.php
index 3292d995739..265b23423f9 100644
--- a/module/VuFind/src/VuFind/Search/Base/Results.php
+++ b/module/VuFind/src/VuFind/Search/Base/Results.php
@@ -209,8 +209,8 @@ abstract class Results
             try {
                 $retVal[] = static::getRecord($id);
             } catch (\Exception $e) {
-                // Just omit missing records from the return array; calling code
-                // in the \VuFind\Record::loadBatch() method will deal with this.
+                // Just omit missing records from the return array; calling code in
+                // \VuFind\Record\Loader::loadBatch() will deal with this.
             }
         }
         return $retVal;
diff --git a/module/VuFind/src/VuFind/Search/Favorites/Results.php b/module/VuFind/src/VuFind/Search/Favorites/Results.php
index 2fcd1ded939..354196d4098 100644
--- a/module/VuFind/src/VuFind/Search/Favorites/Results.php
+++ b/module/VuFind/src/VuFind/Search/Favorites/Results.php
@@ -29,7 +29,7 @@ namespace VuFind\Search\Favorites;
 use VuFind\Db\Table\Resource as ResourceTable,
     VuFind\Db\Table\UserList as UserListTable,
     VuFind\Exception\ListPermission as ListPermissionException,
-    VuFind\Record,
+    VuFind\Record\Loader as RecordLoader,
     VuFind\Search\Base\Results as BaseResults,
     VuFind\Translator\Translator;
 
@@ -172,7 +172,7 @@ class Results extends BaseResults
                 )
             );
         }
-        $this->results = Record::loadBatch($recordsToRequest);
+        $this->results = RecordLoader::loadBatch($recordsToRequest);
     }
 
     /**
diff --git a/module/VuFind/src/VuFind/Search/MixedList/Results.php b/module/VuFind/src/VuFind/Search/MixedList/Results.php
index 31b252d11f2..a29658b8ff3 100644
--- a/module/VuFind/src/VuFind/Search/MixedList/Results.php
+++ b/module/VuFind/src/VuFind/Search/MixedList/Results.php
@@ -26,7 +26,7 @@
  * @link     http://vufind.org   Main Site
  */
 namespace VuFind\Search\MixedList;
-use VuFind\Record, VuFind\Search\Base\Results as BaseResults;
+use VuFind\Record\Loader as RecordLoader, VuFind\Search\Base\Results as BaseResults;
 
 /**
  * Search Mixed List Results
@@ -62,7 +62,7 @@ class Results extends BaseResults
     protected function performSearch()
     {
         $recordsToRequest = $this->getParams()->getRecordsToRequest();
-        $this->results = Record::loadBatch($recordsToRequest);
+        $this->results = RecordLoader::loadBatch($recordsToRequest);
         $this->resultTotal = count($this->results);
     }
 
diff --git a/module/VuFind/src/VuFind/Search/Tags/Results.php b/module/VuFind/src/VuFind/Search/Tags/Results.php
index 9ec276ec1b4..7a783934a6f 100644
--- a/module/VuFind/src/VuFind/Search/Tags/Results.php
+++ b/module/VuFind/src/VuFind/Search/Tags/Results.php
@@ -26,7 +26,7 @@
  * @link     http://vufind.org   Main Site
  */
 namespace VuFind\Search\Tags;
-use VuFind\Db\Table\Tags as TagsTable, VuFind\Record,
+use VuFind\Db\Table\Tags as TagsTable, VuFind\Record\Loader as RecordLoader,
     VuFind\Search\Base\Results as BaseResults;
 
 /**
@@ -74,7 +74,7 @@ class Results extends BaseResults
             $recordsToRequest[]
                 = array('id' => $row->record_id, 'source' => $row->source);
         }
-        $this->results = Record::loadBatch($recordsToRequest);
+        $this->results = RecordLoader::loadBatch($recordsToRequest);
     }
 
     /**
diff --git a/module/VuFind/src/VuFind/Theme/Root/Helper/RecordLink.php b/module/VuFind/src/VuFind/Theme/Root/Helper/RecordLink.php
index 44307b72d6a..6663997a87a 100644
--- a/module/VuFind/src/VuFind/Theme/Root/Helper/RecordLink.php
+++ b/module/VuFind/src/VuFind/Theme/Root/Helper/RecordLink.php
@@ -26,7 +26,7 @@
  * @link     http://vufind.org/wiki/building_a_recommendations_module Wiki
  */
 namespace VuFind\Theme\Root\Helper;
-use VuFind\Record as RecordTools, Zend\View\Helper\AbstractHelper;
+use VuFind\Record\Router as RecordRouter, Zend\View\Helper\AbstractHelper;
 
 /**
  * Record link view helper
@@ -82,7 +82,7 @@ class RecordLink extends AbstractHelper
     {
         // Build the URL:
         $urlHelper = $this->getView()->plugin('url');
-        $details = RecordTools::getActionRouteDetails($driver, $action);
+        $details = RecordRouter::getActionRouteDetails($driver, $action);
         return $urlHelper($details['route'], $details['params']);
     }
 
@@ -134,7 +134,7 @@ class RecordLink extends AbstractHelper
     {
         // Build the URL:
         $urlHelper = $this->getView()->plugin('url');
-        $details = RecordTools::getTabRouteDetails($driver, $tab);
+        $details = RecordRouter::getTabRouteDetails($driver, $tab);
         return $urlHelper($details['route'], $details['params']);
     }
 
-- 
GitLab