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

Table::getByAlias()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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