Passed
Push — master ( 76fde7...d6d75c )
by Magnus
01:55
created

PostCategory::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: root
5
 * Date: 2017-09-27
6
 * Time: 10:27
7
 */
8
9
namespace Radchasay\Comment;
10
11
use \Anax\Database\ActiveRecordModel;
12
13
class PostCategory extends ActiveRecordModel
14
{
15
16
    /**
17
     * @var string $tableName name of the database table.
18
     */
19
    protected $tableName = "PostCategory";
20
21
    /**
22
     * Columns in the table.
23
     *
24
     * @var integer $id primary key auto incremented.
25
     */
26
    public $id;
27
    public $category;
28
29
30
    public function getId($category)
31
    {
32
        $res = $this->find("category", $category);
33
        return $res->id;
34
    }
35
36
37
    public function getCatName($id)
38
    {
39
        $res = $this->find("id", $id);
40
        return $res->category;
41
    }
42
}
43