Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsplitt3r <splitt3r@users.noreply.github.com>2017-10-08 17:38:42 +0300
committersplitt3r <splitt3r@users.noreply.github.com>2017-10-08 17:38:42 +0300
commita5aad195d7359bd4ef7aac0295a44f19f7a94ea5 (patch)
treec270acc26e65f973195300918e8cf09b710b747d /lib/AppInfo
parent4b47fe4f06ae99c01771b6cb26af8f84b2f5b604 (diff)
Refactored db layer
Diffstat (limited to 'lib/AppInfo')
-rw-r--r--lib/AppInfo/Application.php195
1 files changed, 99 insertions, 96 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 0c660506..7adf7558 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -35,59 +35,61 @@ use \OCA\Polls\Db\ParticipationTextMapper;
use \OCA\Polls\Db\TextMapper;
use \OCA\Polls\Controller\PageController;
-class Application extends App {
+class Application extends App
+{
/**
* Application constructor.
*
* @param array $urlParams
*/
- public function __construct(array $urlParams = array()) {
- parent::__construct('polls', $urlParams);
-
- $container = $this->getContainer();
- $server = $container->getServer();
-
- /**
- * Controllers
- */
- $container->registerService('PageController', function ($c) use ($server) {
- /** @var SimpleContainer $c */
- return new PageController(
- $c->query('AppName'),
- $c->query('Request'),
- $c->query('UserManager'),
- $c->query('GroupManager'),
- $c->query('AvatarManager'),
- $c->query('Logger'),
- $c->query('L10N'),
- $c->query('ServerContainer')->getURLGenerator(),
- $c->query('UserId'),
- $c->query('AccessMapper'),
- $c->query('CommentMapper'),
- $c->query('DateMapper'),
- $c->query('EventMapper'),
- $c->query('NotificationMapper'),
- $c->query('ParticipationMapper'),
- $c->query('ParticipationTextMapper'),
- $c->query('TextMapper')
- );
- });
-
- $container->registerService('UserManager', function ($c) {
+ public function __construct(array $urlParams = array())
+ {
+ parent::__construct('polls', $urlParams);
+
+ $container = $this->getContainer();
+ $server = $container->getServer();
+
+ /**
+ * Controllers
+ */
+ $container->registerService('PageController', function ($c) use ($server) {
+ /** @var SimpleContainer $c */
+ return new PageController(
+ $c->query('AppName'),
+ $c->query('Request'),
+ $c->query('UserManager'),
+ $c->query('GroupManager'),
+ $c->query('AvatarManager'),
+ $c->query('Logger'),
+ $c->query('L10N'),
+ $c->query('ServerContainer')->getURLGenerator(),
+ $c->query('UserId'),
+ $c->query('AccessMapper'),
+ $c->query('CommentMapper'),
+ $c->query('DateMapper'),
+ $c->query('EventMapper'),
+ $c->query('NotificationMapper'),
+ $c->query('ParticipationMapper'),
+ $c->query('ParticipationTextMapper'),
+ $c->query('TextMapper')
+ );
+ });
+
+ $container->registerService('UserManager', function ($c) {
/** @var SimpleContainer $c */
- return $c->query('ServerContainer')->getUserManager();
- });
+ return $c->query('ServerContainer')->getUserManager();
+ });
$container->registerService('GroupManager', function ($c) {
/** @var SimpleContainer $c */
return $c->query('ServerContainer')->getGroupManager();
});
- $container->registerService('AvatarManager', function ($c) {
+ $container->registerService('AvatarManager', function ($c) {
/** @var SimpleContainer $c */
- return $c->query('ServerContainer')->getAvatarManager();
- });
+ return $c->query('ServerContainer')->getAvatarManager();
+ });
$container->registerService('Logger', function ($c) {
/** @var SimpleContainer $c */
@@ -98,67 +100,68 @@ class Application extends App {
return $c->query('ServerContainer')->getL10N($c->query('AppName'));
});
- $container->registerService('AccessMapper', function ($c) use ($server) {
- /** @var SimpleContainer $c */
- return new AccessMapper(
- $server->getDatabaseConnection()
- );
- });
-
- $container->registerService('CommentMapper', function ($c) use ($server) {
- /** @var SimpleContainer $c */
- return new CommentMapper(
- $server->getDatabaseConnection()
- );
- });
-
- $container->registerService('DateMapper', function ($c) use ($server) {
- /** @var SimpleContainer $c */
- return new DateMapper(
- $server->getDatabaseConnection()
- );
- });
-
- $container->registerService('EventMapper', function ($c) use ($server) {
- /** @var SimpleContainer $c */
- return new EventMapper(
- $server->getDatabaseConnection()
- );
- });
-
- $container->registerService('NotificationMapper', function ($c) use ($server) {
- /** @var SimpleContainer $c */
- return new NotificationMapper(
- $server->getDatabaseConnection()
- );
- });
-
- $container->registerService('ParticipationMapper', function ($c) use ($server) {
- /** @var SimpleContainer $c */
- return new ParticipationMapper(
- $server->getDatabaseConnection()
- );
- });
-
- $container->registerService('ParticipationTextMapper', function ($c) use ($server) {
- /** @var SimpleContainer $c */
- return new ParticipationTextMapper(
- $server->getDatabaseConnection()
- );
- });
-
- $container->registerService('TextMapper', function ($c) use ($server) {
- /** @var SimpleContainer $c */
- return new TextMapper(
- $server->getDatabaseConnection()
- );
- });
- }
+ $container->registerService('AccessMapper', function ($c) use ($server) {
+ /** @var SimpleContainer $c */
+ return new AccessMapper(
+ $server->getDatabaseConnection()
+ );
+ });
+
+ $container->registerService('CommentMapper', function ($c) use ($server) {
+ /** @var SimpleContainer $c */
+ return new CommentMapper(
+ $server->getDatabaseConnection()
+ );
+ });
+
+ $container->registerService('DateMapper', function ($c) use ($server) {
+ /** @var SimpleContainer $c */
+ return new DateMapper(
+ $server->getDatabaseConnection()
+ );
+ });
+
+ $container->registerService('EventMapper', function ($c) use ($server) {
+ /** @var SimpleContainer $c */
+ return new EventMapper(
+ $server->getDatabaseConnection()
+ );
+ });
+
+ $container->registerService('NotificationMapper', function ($c) use ($server) {
+ /** @var SimpleContainer $c */
+ return new NotificationMapper(
+ $server->getDatabaseConnection()
+ );
+ });
+
+ $container->registerService('ParticipationMapper', function ($c) use ($server) {
+ /** @var SimpleContainer $c */
+ return new ParticipationMapper(
+ $server->getDatabaseConnection()
+ );
+ });
+
+ $container->registerService('ParticipationTextMapper', function ($c) use ($server) {
+ /** @var SimpleContainer $c */
+ return new ParticipationTextMapper(
+ $server->getDatabaseConnection()
+ );
+ });
+
+ $container->registerService('TextMapper', function ($c) use ($server) {
+ /** @var SimpleContainer $c */
+ return new TextMapper(
+ $server->getDatabaseConnection()
+ );
+ });
+ }
/**
* Register navigation entry for main navigation.
*/
- public function registerNavigationEntry() {
+ public function registerNavigationEntry()
+ {
$container = $this->getContainer();
$container->query('OCP\INavigationManager')->add(function () use ($container) {
$urlGenerator = $container->query('OCP\IURLGenerator');