From 019f93d697445e1fed1de3970e7997021296be8b Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Fri, 6 Feb 2015 13:47:51 -0500
Subject: [PATCH] Code simplification.

---
 .../VuFind/src/VuFind/Session/AbstractBase.php | 16 +++-------------
 .../VuFind/src/VuFind/Statistics/Driver/Db.php | 18 +++---------------
 2 files changed, 6 insertions(+), 28 deletions(-)

diff --git a/module/VuFind/src/VuFind/Session/AbstractBase.php b/module/VuFind/src/VuFind/Session/AbstractBase.php
index aa9b258706d..9603b4c7796 100644
--- a/module/VuFind/src/VuFind/Session/AbstractBase.php
+++ b/module/VuFind/src/VuFind/Session/AbstractBase.php
@@ -40,7 +40,9 @@ use Zend\Session\SaveHandler\SaveHandlerInterface;
 abstract class AbstractBase implements SaveHandlerInterface,
     \VuFind\Db\Table\DbTableAwareInterface
 {
-    use \VuFind\Db\Table\DbTableAwareTrait;
+    use \VuFind\Db\Table\DbTableAwareTrait {
+        getDbTable as getTable;
+    }
 
     /**
      * Session lifetime in seconds
@@ -139,16 +141,4 @@ abstract class AbstractBase implements SaveHandlerInterface,
         //   is called by the garbage collector and everything is good.
         // Something to keep in mind though.
     }
-
-    /**
-     * Get a database table object.
-     *
-     * @param string $table Name of table to retrieve
-     *
-     * @return \VuFind\Db\Table\Gateway
-     */
-    protected function getTable($table)
-    {
-        return $this->getDbTableManager()->get($table);
-    }
 }
\ No newline at end of file
diff --git a/module/VuFind/src/VuFind/Statistics/Driver/Db.php b/module/VuFind/src/VuFind/Statistics/Driver/Db.php
index ea702c05ff1..c06e0b0766e 100644
--- a/module/VuFind/src/VuFind/Statistics/Driver/Db.php
+++ b/module/VuFind/src/VuFind/Statistics/Driver/Db.php
@@ -57,7 +57,7 @@ class Db extends AbstractBase implements \VuFind\Db\Table\DbTableAwareInterface
         // Make sure the browser version is a legal length.
         $userData['browserVersion'] = substr($userData['browserVersion'], 0, 8);
 
-        $this->getTable('UserStatsFields')->save($data, $userData);
+        $this->getDbTable('UserStatsFields')->save($data, $userData);
     }
 
     /**
@@ -71,7 +71,7 @@ class Db extends AbstractBase implements \VuFind\Db\Table\DbTableAwareInterface
     public function getFullList($field, $value = array())
     {
         // Use the model
-        return $this->getTable('UserStatsFields')->getFields($field, $value)
+        return $this->getDbTable('UserStatsFields')->getFields($field, $value)
             ->toArray();
     }
 
@@ -85,19 +85,7 @@ class Db extends AbstractBase implements \VuFind\Db\Table\DbTableAwareInterface
      */
     public function getBrowserStats($version, $limit)
     {
-        $userStats = $this->getTable('UserStats');
+        $userStats = $this->getDbTable('UserStats');
         return $userStats->getBrowserStats($version, $limit);
     }
-
-    /**
-     * Get a database table object.
-     *
-     * @param string $table Name of table to retrieve
-     *
-     * @return \VuFind\Db\Table\Gateway
-     */
-    protected function getTable($table)
-    {
-        return $this->getDbTableManager()->get($table);
-    }
 }
-- 
GitLab