Completed
Branch master (495df4)
by Anton
01:49
created

Table::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
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
11
namespace Application\Pages;
12
13
use Application\Users;
14
15
/**
16
 * Pages Table
17
 *
18
 * @package  Application\Pages
19
 *
20
 * @method   static Row findRow($primaryKey)
21
 * @method   static Row findRowWhere($whereList)
22
 */
23
class Table extends \Bluz\Db\Table
24
{
25
    /**
26
     * Table
27
     *
28
     * @var string
29
     */
30
    protected $name = 'pages';
31
32
    /**
33
     * Primary key(s)
34
     *
35
     * @var array
36
     */
37
    protected $primary = array('id');
38
39
    /**
40
     * Get page by Alias
41
     *
42
     * @param $alias
43
     *
44
     * @return Row
45
     */
46 2
    public function getByAlias($alias)
47
    {
48 2
        return self::findRowWhere(['alias' => $alias]);
49
    }
50
51
    /**
52
     * Init table relations
53
     *
54
     * @return void
55
     */
56 1
    public function init()
57
    {
58 1
        $this->linkTo('userId', 'Users', 'id');
59 1
    }
60
}
61