Completed
Push — master ( 9b9020...8f5910 )
by Razon
02:07
created

MySessionController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 13
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A findModelById() 0 5 1
A getQuery() 0 4 1
1
<?php
2
namespace App\Http\Api\Backend\Controller;
3
4
use Yii;
5
use App\Http\Api\Backend\Model\Session;
6
7
class MySessionController extends SessionController
8
{
9
    public function getQuery($action)
10
    {
11
        return parent::getQuery($action)
12
            ->andWhere(['us.user_id' => Yii::$app->getUser()->getId()]);
13
    }
14
15
    public function findModelById($id, $action)
16
    {
17
        return Session::findOne([
18
            'id' => $id,
19
            'user_id' => Yii::$app->getUser()->getId(),
20
        ]);
21
    }
22
}