Completed
Push — master ( 7db380...c18000 )
by Anton
12s
created

Grid::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 12
ccs 0
cts 10
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * @copyright Bluz PHP Team
4
 * @link https://github.com/bluzphp/skeleton
5
 */
6
7
/**
8
 * @namespace
9
 */
10
namespace Application\Pages;
11
12
use Bluz\Grid\Source\SqlSource;
13
14
/**
15
 * Grid of Pages
16
 *
17
 * @package  Application\Pages
18
 */
19
class Grid extends \Bluz\Grid\Grid
20
{
21
    /**
22
     * @var string
23
     */
24
    protected $uid = 'pages';
25
26
    /**
27
     * init
28
     *
29
     * @return self
30
     */
31
    public function init()
32
    {
33
         // Setup source
34
         $adapter = new SqlSource();
35
         $adapter->setSource('SELECT * FROM pages');
36
37
         $this->setAdapter($adapter);
38
         $this->setDefaultLimit(25);
39
         $this->setAllowOrders(['title', 'id', 'created', 'updated']);
40
         $this->setAllowFilters(['title', 'alias', 'description', 'content', 'id']);
41
         return $this;
42
    }
43
}
44