summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-04-19 19:30:12 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-04-19 19:30:12 +0200
commit4a7e0561caebd470fbaaf88655619930260a573e (patch)
treedf8451dc9126c574144b4f907840899d16c62fca
parent0fe4db099265c7e7a9f4be2c98bb3d9329670286 (diff)
downloadnextcloud-server-4a7e0561caebd470fbaaf88655619930260a573e.tar.gz
nextcloud-server-4a7e0561caebd470fbaaf88655619930260a573e.zip
move db into iservercontainer
-rw-r--r--lib/private/appframework/db/db.php2
-rw-r--r--lib/private/appframework/dependencyinjection/dicontainer.php7
-rw-r--r--lib/private/server.php13
-rw-r--r--lib/public/appframework/db/mapper.php2
-rw-r--r--lib/public/idb.php (renamed from lib/public/appframework/db/idb.php)2
-rw-r--r--lib/public/iservercontainer.php8
-rw-r--r--tests/lib/appframework/db/MapperTest.php2
-rw-r--r--tests/lib/appframework/db/MapperTestUtility.php2
8 files changed, 28 insertions, 10 deletions
diff --git a/lib/private/appframework/db/db.php b/lib/private/appframework/db/db.php
index 713b39175c6..fc77a38f814 100644
--- a/lib/private/appframework/db/db.php
+++ b/lib/private/appframework/db/db.php
@@ -23,7 +23,7 @@
namespace OC\AppFramework\Db;
-use \OCP\AppFramework\Db\IDb;
+use \OCP\IDb;
/**
diff --git a/lib/private/appframework/dependencyinjection/dicontainer.php b/lib/private/appframework/dependencyinjection/dicontainer.php
index 0faa507c76e..73d356e9852 100644
--- a/lib/private/appframework/dependencyinjection/dicontainer.php
+++ b/lib/private/appframework/dependencyinjection/dicontainer.php
@@ -62,13 +62,6 @@ class DIContainer extends SimpleContainer implements IAppContainer{
});
/**
- * Database
- */
- $this['Db'] = $this->share(function($c){
- return new Db();
- });
-
- /**
* Http
*/
$this['Request'] = $this->share(function($c) {
diff --git a/lib/private/server.php b/lib/private/server.php
index 5d90a0b19fc..e977c643832 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -3,6 +3,7 @@
namespace OC;
use OC\AppFramework\Http\Request;
+use OC\AppFramework\Db\Db;
use OC\AppFramework\Utility\SimpleContainer;
use OC\Cache\UserCache;
use OC\DB\ConnectionWrapper;
@@ -177,6 +178,9 @@ class Server extends SimpleContainer implements IServerContainer {
}
return $router;
});
+ $this['Db'] = $this->share(function($c){
+ return new Db();
+ });
}
/**
@@ -392,4 +396,13 @@ class Server extends SimpleContainer implements IServerContainer {
function getRouter(){
return $this->query('Router');
}
+
+
+ /**
+ * Returns an instance of the db facade
+ * @return \OCP\IDb
+ */
+ function getDb() {
+ return $this->query('Db');
+ }
}
diff --git a/lib/public/appframework/db/mapper.php b/lib/public/appframework/db/mapper.php
index 3e9778dbc61..46240649c77 100644
--- a/lib/public/appframework/db/mapper.php
+++ b/lib/public/appframework/db/mapper.php
@@ -26,6 +26,8 @@
namespace OCP\AppFramework\Db;
+use \OCP\IDb;
+
/**
* Simple parent class for inheriting your data access layer from. This class
diff --git a/lib/public/appframework/db/idb.php b/lib/public/idb.php
index e5313476f40..82a8a681500 100644
--- a/lib/public/appframework/db/idb.php
+++ b/lib/public/idb.php
@@ -21,7 +21,7 @@
*
*/
-namespace OCP\AppFramework\Db;
+namespace OCP;
/**
diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php
index 600d81d83af..22176c36b8a 100644
--- a/lib/public/iservercontainer.php
+++ b/lib/public/iservercontainer.php
@@ -113,6 +113,14 @@ interface IServerContainer {
*/
function getConfig();
+
+ /**
+ * Returns an instance of the db facade
+ * @return \OCP\IDb
+ */
+ function getDb();
+
+
/**
* Returns the app config manager
*
diff --git a/tests/lib/appframework/db/MapperTest.php b/tests/lib/appframework/db/MapperTest.php
index c4eb35a068e..114081beb21 100644
--- a/tests/lib/appframework/db/MapperTest.php
+++ b/tests/lib/appframework/db/MapperTest.php
@@ -24,6 +24,8 @@
namespace OCP\AppFramework\Db;
+use \OCP\IDb;
+
require_once __DIR__ . '/MapperTestUtility.php';
diff --git a/tests/lib/appframework/db/MapperTestUtility.php b/tests/lib/appframework/db/MapperTestUtility.php
index ecd79fef263..4c81d4cd27b 100644
--- a/tests/lib/appframework/db/MapperTestUtility.php
+++ b/tests/lib/appframework/db/MapperTestUtility.php
@@ -46,7 +46,7 @@ abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase {
*/
protected function setUp(){
$this->db = $this->getMockBuilder(
- '\OCP\AppFramework\Db\IDb')
+ '\OCP\IDb')
->disableOriginalConstructor()
->getMock();