@@ -53,7 +53,8 @@ public static function tableName()
53
53
public function rules ()
54
54
{
55
55
return [
56
- [['entity ' , 'entityId ' , 'content ' ], 'required ' ],
56
+ [['entity ' , 'entityId ' ], 'required ' ],
57
+ ['content ' , 'required ' , 'message ' => Yii::t ('yii2mod.comments ' , 'Comment cannot be blank. ' )],
57
58
[['content ' , 'entity ' , 'relatedTo ' ], 'string ' ],
58
59
['parentId ' , 'validateParentID ' ],
59
60
[['entityId ' , 'parentId ' , 'createdBy ' , 'updatedBy ' , 'status ' , 'createdAt ' , 'updatedAt ' , 'level ' ], 'integer ' ],
@@ -113,8 +114,10 @@ public function attributeLabels()
113
114
{
114
115
return [
115
116
'id ' => Yii::t ('yii2mod.comments ' , 'ID ' ),
116
- 'content ' => Yii::t ('yii2mod.comments ' , 'Comment ' ),
117
+ 'content ' => Yii::t ('yii2mod.comments ' , 'Content ' ),
117
118
'entity ' => Yii::t ('yii2mod.comments ' , 'Entity ' ),
119
+ 'entityId ' => Yii::t ('yii2mod.comments ' , 'Entity ID ' ),
120
+ 'parentId ' => Yii::t ('yii2mod.comments ' , 'Parent ID ' ),
118
121
'status ' => Yii::t ('yii2mod.comments ' , 'Status ' ),
119
122
'level ' => Yii::t ('yii2mod.comments ' , 'Level ' ),
120
123
'createdBy ' => Yii::t ('yii2mod.comments ' , 'Created by ' ),
@@ -168,7 +171,7 @@ public function afterSave($insert, $changedAttributes)
168
171
self ::updateAll (['status ' => CommentStatus::DELETED ], ['parentId ' => $ this ->id ]);
169
172
}
170
173
}
171
-
174
+
172
175
parent ::afterSave ($ insert , $ changedAttributes );
173
176
}
174
177
@@ -323,9 +326,9 @@ public function getAuthorName()
323
326
* @param string $deletedCommentText
324
327
* @return string
325
328
*/
326
- public function getContent ($ deletedCommentText = 'Comment was deleted. ' )
329
+ public function getContent ($ deletedCommentText = 'Comment has been deleted. ' )
327
330
{
328
- return $ this ->isDeleted ? $ deletedCommentText : nl2br ($ this ->content );
331
+ return $ this ->isDeleted ? Yii:: t ( ' yii2mod.comments ' , $ deletedCommentText) : nl2br ($ this ->content );
329
332
}
330
333
331
334
/**
0 commit comments