1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-12 10:26:31 +00:00
ocsms/appinfo/application.php

62 lines
1.2 KiB
PHP

<?php
/**
* ownCloud - ocsms
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Loic Blot <loic.blot@unix-experience.fr>
* @copyright Loic Blot 2014
*/
namespace OCA\OcSms\AppInfo;
use \OCP\AppFramework\App;
use \OCA\OcSms\Controller\SmsController;
use \OCA\MyApp\Db\Sms;
use \OCA\MyApp\Db\SmsMapper;
class Application extends App {
public function __construct (array $urlParams=array()) {
parent::__construct('ocsms', $urlParams);
$container = $this->getContainer();
/**
* Controllers
*/
$container->registerService('SmsController', function($c) {
return new SmsController(
$c->query('AppName'),
$c->query('Request'),
$c->query('UserId')
);
});
/**
* Database Layer
*/
$container->registerService('Sms', function($c) {
return new Sms($c->query('ServerContainer')->getDb());
});
$container->registerService('SmsMapper', function($c) {
return new SmsMapper($c->query('ServerContainer')->getDb());
});
/**
* Core
*/
$container->registerService('UserId', function($c) {
return \OCP\User::getUser();
});
}
}