From 9a7f83a4fb92a2f8f28caa5d65fccddce1be7ce9 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Mon, 22 Oct 2012 13:36:43 -0400
Subject: [PATCH] Renamed dbadapter service to VuFind\DbAdapter.

---
 module/VuFind/config/module.config.php                    | 2 +-
 module/VuFind/src/VuFind/Controller/UpgradeController.php | 2 +-
 module/VuFind/src/VuFind/Db/Row/User.php                  | 2 +-
 module/VuFind/src/VuFind/Db/Table/PluginManager.php       | 3 ++-
 module/VuFind/src/VuFind/Log/Logger.php                   | 2 +-
 module/VuFind/src/VuFindTest/Unit/DbTestCase.php          | 4 +++-
 6 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php
index c4ece74f728..5333d7a722b 100644
--- a/module/VuFind/config/module.config.php
+++ b/module/VuFind/config/module.config.php
@@ -279,7 +279,7 @@ $config = array(
     ),
     'service_manager' => array(
         'factories' => array(
-            'dbadapter' => function ($sm) {
+            'VuFind\DbAdapter' => function ($sm) {
                 return \VuFind\Db\AdapterFactory::getAdapter();
             },
             'ilsconnection' => function ($sm) {
diff --git a/module/VuFind/src/VuFind/Controller/UpgradeController.php b/module/VuFind/src/VuFind/Controller/UpgradeController.php
index 2cdb84c9135..3b92eec6306 100644
--- a/module/VuFind/src/VuFind/Controller/UpgradeController.php
+++ b/module/VuFind/src/VuFind/Controller/UpgradeController.php
@@ -201,7 +201,7 @@ class UpgradeController extends AbstractBase
         try {
             // Set up the helper with information from our SQL file:
             $this->dbUpgrade()
-                ->setAdapter($this->getServiceLocator()->get('DBAdapter'))
+                ->setAdapter($this->getServiceLocator()->get('VuFind\DbAdapter'))
                 ->loadSql(APPLICATION_PATH . '/module/VuFind/sql/mysql.sql');
 
             // Check for missing tables.  Note that we need to finish dealing with
diff --git a/module/VuFind/src/VuFind/Db/Row/User.php b/module/VuFind/src/VuFind/Db/Row/User.php
index 81adc1ea71c..14d5191e2cf 100644
--- a/module/VuFind/src/VuFind/Db/Row/User.php
+++ b/module/VuFind/src/VuFind/Db/Row/User.php
@@ -80,7 +80,7 @@ class User extends ServiceLocatorAwareGateway
         // reconnect to the database as part of the save action to prevent
         // exceptions:
         $this->sql = new Sql(
-            $this->getServiceLocator()->getServiceLocator()->get('DBAdapter'),
+            $this->getServiceLocator()->getServiceLocator()->get('VuFind\DbAdapter'),
             $this->table
         );
         return parent::save();
diff --git a/module/VuFind/src/VuFind/Db/Table/PluginManager.php b/module/VuFind/src/VuFind/Db/Table/PluginManager.php
index f301668be7f..346b028350b 100644
--- a/module/VuFind/src/VuFind/Db/Table/PluginManager.php
+++ b/module/VuFind/src/VuFind/Db/Table/PluginManager.php
@@ -50,7 +50,8 @@ class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager
     ) {
         parent::__construct($configuration);
         $initializer = function ($instance, $manager) {
-            $instance->setAdapter($manager->getServiceLocator()->get('DBAdapter'));
+            $instance
+                ->setAdapter($manager->getServiceLocator()->get('VuFind\DbAdapter'));
             $instance->initialize();
         };
         $this->addInitializer($initializer, false);
diff --git a/module/VuFind/src/VuFind/Log/Logger.php b/module/VuFind/src/VuFind/Log/Logger.php
index b1bd5f5d32c..ef5ddb73577 100644
--- a/module/VuFind/src/VuFind/Log/Logger.php
+++ b/module/VuFind/src/VuFind/Log/Logger.php
@@ -94,7 +94,7 @@ class Logger extends BaseLogger implements ServiceLocatorAwareInterface
             // Make Writers
             $filters = explode(',', $error_types);
             $writer = new Writer\Db(
-                $this->getServiceLocator()->get('DBAdapter'),
+                $this->getServiceLocator()->get('VuFind\DbAdapter'),
                 $table_name, $columnMapping
             );
             $this->addWriters($writer, $filters);
diff --git a/module/VuFind/src/VuFindTest/Unit/DbTestCase.php b/module/VuFind/src/VuFindTest/Unit/DbTestCase.php
index 08121c7f2e6..a05f9f3c5ec 100644
--- a/module/VuFind/src/VuFindTest/Unit/DbTestCase.php
+++ b/module/VuFind/src/VuFindTest/Unit/DbTestCase.php
@@ -52,7 +52,9 @@ abstract class DbTestCase extends TestCase
 
         // Add database service:
         if (!$sm->has('VuFind\DbTablePluginManager')) {
-            $sm->setService('DBAdapter', \VuFind\Db\AdapterFactory::getAdapter());
+            $sm->setService(
+                'VuFind\DbAdapter', \VuFind\Db\AdapterFactory::getAdapter()
+            );
             $factory = new \VuFind\Db\Table\PluginManager(
                 new \Zend\ServiceManager\Config(
                     array(
-- 
GitLab