Skip to content

Commit

Permalink
'api'
Browse files Browse the repository at this point in the history
  • Loading branch information
yidashi committed Feb 16, 2017
1 parent 974d147 commit 7ca7511
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 21 deletions.
2 changes: 1 addition & 1 deletion api/common/controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Controller extends \yii\rest\Controller
public function behaviors()
{
$behaviors = parent::behaviors();
unset($behaviors['contentNegotiator']['formats']['application/xml']);
unset($behaviors['contentNegotiator']);
$behaviors['cors'] = [
'class' => Cors::className(),
];
Expand Down
11 changes: 1 addition & 10 deletions api/config/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,11 @@
return [
'id' => 'app-api',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'controllerNamespace' => 'api\common\controllers',
'components' => [
'user' => [
'identityClass' => 'common\modules\user\models\User',
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
Expand All @@ -35,6 +25,7 @@
],
],
'response' => [
'format' => 'json',
'on beforeSend' => function($event) {
$response = $event->sender;
if ($response->data !== null) {
Expand Down
6 changes: 4 additions & 2 deletions api/modules/v1/controllers/ArticleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@

class ArticleController extends Controller
{
public function actionIndex($cid = '')
public function actionIndex($cid = null, $module = null)
{
$query = Article::find()->published()->andFilterWhere(['category_id' => $cid]);
$query = Article::find()->published()
->andFilterWhere(['category_id' => $cid])
->andFilterWhere(['module' => $module]);
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => [
Expand Down
1 change: 0 additions & 1 deletion api/modules/v1/models/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

class Article extends \common\models\Article
{

public function extraFields()
{
return [
Expand Down
3 changes: 0 additions & 3 deletions backend/config/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@
'themeManager' => [
'class' => 'common\components\ThemeManager',
],
'pluginManager' => [
'class' => 'common\components\PluginManager',
],
],
'modules' => [
'rbac' => [
Expand Down
5 changes: 4 additions & 1 deletion common/config/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
'notify' => 'common\components\notify\Handler',
'moduleManager' => [
'class' => 'common\\components\\ModuleManager'
]
],
'pluginManager' => [
'class' => 'common\components\PluginManager',
],
],
];
3 changes: 0 additions & 3 deletions frontend/config/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
}
}
],
'pluginManager' => [
'class' => 'common\components\PluginManager',
],
'search' => [
'class' => 'frontend\\components\\Search',
'engine' => env('SEARCH_ENGINE', 'local')
Expand Down

0 comments on commit 7ca7511

Please sign in to comment.