This repository was archived by the owner on Sep 25, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApiModule.php
More file actions
53 lines (49 loc) · 1.59 KB
/
ApiModule.php
File metadata and controls
53 lines (49 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* CiiMS API Module
*
* This is a stand alone module for CiiMS that adds a JSON REST API functionality to CiiMS
*
* @package CiiMS (https://github.com/charlesportwoodii/CiiMS)
* @link https://github.com/charlesportwoodii/ciims-modules-api
* @author Charles R. Portwood I <charlesportwoodii@ethreal.net>
* @copyright 2011-2015 Charles R. Portwood II
* @license MIT License
*/
/**
* API Module
* Required definition for CWebModule integratoin with Yii2
*/
class ApiModule extends CWebModule
{
/**
* Yii Init method
* Implements basic configuration for module
*/
public function init()
{
// Autoload the models and components directory
$this->setImport(array(
'api.models.*',
'api.components.*',
));
// Disable layout rendering
$this->layout = false;
// Disable logging for the API
foreach(Yii::app()->log->routes as $k=>$v)
{
if (get_class($v) == 'CWebLogRoute' || get_class($v) == "CProfileLogRoute")
Yii::app()->log->routes[$k]->enabled = false;
}
// Set default components and routes
Yii::app()->setComponents(array(
'errorHandler' => array(
'errorAction' => 'api/default/error',
),
'messages' => array(
'class' => 'cii.components.CiiPHPMessageSource',
'basePath' => Yii::getPathOfAlias('application.modules.api')
)
));
}
}