Code Duplication    Length = 48-48 lines in 2 locations

common/models/PostTypeTaxonomy.php 1 location

@@ 25-72 (lines=48) @@
22
 * @author Agiel K. Saputra <[email protected]>
23
 * @since 0.1.0
24
 */
25
class PostTypeTaxonomy extends ActiveRecord
26
{
27
    /**
28
     * @inheritdoc
29
     */
30
    public static function tableName()
31
    {
32
        return '{{%post_type_taxonomy}}';
33
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38
    public function rules()
39
    {
40
        return [
41
            [['post_type_id', 'taxonomy_id'], 'required'],
42
            [['post_type_id', 'taxonomy_id'], 'integer'],
43
        ];
44
    }
45
46
    /**
47
     * @inheritdoc
48
     */
49
    public function attributeLabels()
50
    {
51
        return [
52
            'post_type_id' => Yii::t('writesdown', 'Post Type ID'),
53
            'taxonomy_id' => Yii::t('writesdown', 'Taxonomy ID'),
54
        ];
55
    }
56
57
    /**
58
     * @return \yii\db\ActiveQuery
59
     */
60
    public function getPostType()
61
    {
62
        return $this->hasOne(PostType::className(), ['id' => 'post_type_id']);
63
    }
64
65
    /**
66
     * @return \yii\db\ActiveQuery
67
     */
68
    public function getTaxonomy()
69
    {
70
        return $this->hasOne(Taxonomy::className(), ['id' => 'taxonomy_id']);
71
    }
72
}
73

common/models/TermRelationship.php 1 location

@@ 25-72 (lines=48) @@
22
 * @author  Agiel K. Saputra <[email protected]>
23
 * @since   0.1.0
24
 */
25
class TermRelationship extends ActiveRecord
26
{
27
    /**
28
     * @inheritdoc
29
     */
30
    public static function tableName()
31
    {
32
        return '{{%term_relationship}}';
33
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38
    public function rules()
39
    {
40
        return [
41
            [['post_id', 'term_id'], 'required'],
42
            [['post_id', 'term_id'], 'integer'],
43
        ];
44
    }
45
46
    /**
47
     * @inheritdoc
48
     */
49
    public function attributeLabels()
50
    {
51
        return [
52
            'post_id' => Yii::t('writesdown', 'Post ID'),
53
            'term_id' => Yii::t('writesdown', 'Term ID'),
54
        ];
55
    }
56
57
    /**
58
     * @return \yii\db\ActiveQuery
59
     */
60
    public function getPost()
61
    {
62
        return $this->hasOne(Post::className(), ['id' => 'post_id']);
63
    }
64
65
    /**
66
     * @return \yii\db\ActiveQuery
67
     */
68
    public function getTerm()
69
    {
70
        return $this->hasOne(Term::className(), ['id' => 'term_id']);
71
    }
72
}
73