Passed
Push — master ( 806287...909ea5 )
by Lydia
02:52
created

Comment   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
dl 0
loc 31
ccs 0
cts 9
cp 0
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A findAllCommentsWhere() 0 10 2
1
<?php
2
3
namespace Lyco\Comment;
4
5
use Anax\DatabaseActiveRecord\ActiveRecordModel;
6
7
8
/**
9
 * A database driven model using the Active Record design pattern.
10
 */
11
class Comment extends ActiveRecordModel
12
{
13
    /**
14
     * @var string $tableName name of the database table.
15
     */
16
    protected $tableName = "Comment";
17
    protected $tableIdColumn = "commentId";
18
19
20
21
    /**
22
     * Columns in the table.
23
     *
24
     * @var integer $id primary key auto incremented.
25
     */
26
    public $commentId;
27
    public $postId;
28
    public $replyId;
29
    public $id;
30
    public $text;
31
32
    public function findAllCommentsWhere($where, $value)
33
    {
34
        $this->checkDb();
35
        $params = is_array($value) ? $value : [$value];
36
        return $this->db->connect()
37
                        ->select()
38
                        ->from($this->tableName)
39
                        ->where($where . " = ?")
40
                        ->execute($params)
41
                        ->fetchAllClass(get_class($this));
42
    }
43
}
44