Completed
Push — master ( c18000...efec97 )
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 8
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 12
ccs 8
cts 8
cp 1
crap 1
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 1
    public function init()
32
    {
33
         // Setup source
34 1
         $adapter = new SqlSource();
35 1
         $adapter->setSource('SELECT * FROM pages');
36
37 1
         $this->setAdapter($adapter);
38 1
         $this->setDefaultLimit(25);
39 1
         $this->setAllowOrders(['title', 'id', 'created', 'updated']);
40 1
         $this->setAllowFilters(['title', 'alias', 'description', 'content', 'id']);
41 1
         return $this;
42
    }
43
}
44