Completed
Push — master ( 6919a8...328ff4 )
by Razon
02:59
created

ArticleComment   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 23
c 1
b 0
f 0
dl 0
loc 60
ccs 0
cts 44
cp 0
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 0 8 1
A tableName() 0 3 1
A getUser() 0 3 1
A behaviors() 0 7 1
A attributeLabels() 0 11 1
A getArticle() 0 3 1
1
<?php
2
3
namespace App\Model;
4
5
use Yii;
6
7
/**
8
 * This is the model class for table "{{%article_comment}}".
9
 *
10
 * @property int $id
11
 * @property int $reply_to Reply To
12
 * @property int $article_id Article ID
13
 * @property int $user_id User ID
14
 * @property string $content Content
15
 * @property int $is_deleted Is Deleted
16
 * @property int $create_time Create Time
17
 * @property int $update_time Update Time
18
 * 
19
 * @property Article $article
20
 * @property User $user
21
 */
22
class ArticleComment extends \App\Model\ActiveRecord
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public static function tableName()
28
    {
29
        return '{{%article_comment}}';
30
    }
31
32
    public function behaviors()
33
    {
34
        return [
35
            TimestampBehavior::class,
0 ignored issues
show
Bug introduced by
The type App\Model\TimestampBehavior was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
36
            [
37
                'class' => CreatorBehavior::class,
0 ignored issues
show
Bug introduced by
The type App\Model\CreatorBehavior was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
38
                'creatorAttribute' => 'user_id',
39
            ]
40
        ];
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function rules()
47
    {
48
        return [
49
            [['reply_to', 'article_id', 'user_id', 'is_deleted', 'create_time', 'update_time'], 'integer'],
50
            [['article_id', 'user_id', 'content'], 'required'],
51
            [['content'], 'string'],
52
            ['article_id', 'exist', 'targetClass' => Article::class, 'targetAttribute' => 'id'],
53
            ['user_id', 'exist', 'targetClass' => User::class, 'targetAttribute' => 'id'],
54
        ];
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function attributeLabels()
61
    {
62
        return [
63
            'id' => Yii::t('app', 'ID'),
64
            'reply_to' => Yii::t('app', 'Reply To'),
65
            'article_id' => Yii::t('app', 'Article ID'),
66
            'user_id' => Yii::t('app', 'User ID'),
67
            'content' => Yii::t('app', 'Content'),
68
            'is_deleted' => Yii::t('app', 'Is Deleted'),
69
            'create_time' => Yii::t('app', 'Create Time'),
70
            'update_time' => Yii::t('app', 'Update Time'),
71
        ];
72
    }
73
74
    public function getArticle()
75
    {
76
        return $this->hasOne(Article::class, ['id' => 'article_id']);
77
    }
78
79
    public function getUser()
80
    {
81
        return $this->hasOne(User::class, ['id' => 'user_id']);
82
    }
83
}
84