diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-04-19 19:30:12 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-04-19 19:30:12 +0200 |
commit | 4a7e0561caebd470fbaaf88655619930260a573e (patch) | |
tree | df8451dc9126c574144b4f907840899d16c62fca /lib | |
parent | 0fe4db099265c7e7a9f4be2c98bb3d9329670286 (diff) | |
download | nextcloud-server-4a7e0561caebd470fbaaf88655619930260a573e.tar.gz nextcloud-server-4a7e0561caebd470fbaaf88655619930260a573e.zip |
move db into iservercontainer
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/appframework/db/db.php | 2 | ||||
-rw-r--r-- | lib/private/appframework/dependencyinjection/dicontainer.php | 7 | ||||
-rw-r--r-- | lib/private/server.php | 13 | ||||
-rw-r--r-- | lib/public/appframework/db/mapper.php | 2 | ||||
-rw-r--r-- | lib/public/idb.php (renamed from lib/public/appframework/db/idb.php) | 2 | ||||
-rw-r--r-- | lib/public/iservercontainer.php | 8 |
6 files changed, 25 insertions, 9 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 * |