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

MySessionController::findModelById()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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
}