Grid   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 28
dl 0
loc 43
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 32 1
1
<?php
2
/**
3
 * @namespace
4
 */
5
namespace Application\Push;
6
7
use Bluz\Grid\Source\SelectSource;
8
9
/**
10
 * Grid based on Table
11
 *
12
 * @package  Application\Push
13
 *
14
 * @author   Anton Shevchuk
15
 * @created  2018-11-07 18:34:22
16
 */
17
class Grid extends \Bluz\Grid\Grid
18
{
19
    /**
20
     * @var string
21
     */
22
    protected $uid = 'push';
23
24
    /**
25
     * @return void
26
     * @throws \Bluz\Grid\GridException
27
     */
28
    public function init() : void
29
    {
30
        $select = Table::select();
31
        $select
32
            ->addSelect('users.login AS login')
33
            ->leftJoin('push', 'users', 'users', 'push.userId = users.id');
34
35
        // Current table as source of grid
36
        $adapter = new SelectSource();
37
        $adapter->setSource($select);
38
39
        $this->setAdapter($adapter);
40
        $this->setDefaultLimit(25);
41
        $this->setAllowFilters([
42
            'id',
43
            'userId',
44
            'authToken',
45
            'contentEncoding',
46
            'endpoint',
47
            'publicKey',
48
            'created',
49
            'updated',
50
        ]);
51
        $this->setAllowOrders([
52
            'id',
53
            'userId',
54
            'authToken',
55
            'contentEncoding',
56
            'endpoint',
57
            'publicKey',
58
            'created',
59
            'updated',
60
        ]);
61
    }
62
}
63