@@ -53,7 +53,8 @@ public static function tableName()
5353 public function rules ()
5454 {
5555 return [
56- [['entity ' , 'entityId ' , 'content ' ], 'required ' ],
56+ [['entity ' , 'entityId ' ], 'required ' ],
57+ ['content ' , 'required ' , 'message ' => Yii::t ('yii2mod.comments ' , 'Comment cannot be blank. ' )],
5758 [['content ' , 'entity ' , 'relatedTo ' ], 'string ' ],
5859 ['parentId ' , 'validateParentID ' ],
5960 [['entityId ' , 'parentId ' , 'createdBy ' , 'updatedBy ' , 'status ' , 'createdAt ' , 'updatedAt ' , 'level ' ], 'integer ' ],
@@ -113,8 +114,10 @@ public function attributeLabels()
113114 {
114115 return [
115116 'id ' => Yii::t ('yii2mod.comments ' , 'ID ' ),
116- 'content ' => Yii::t ('yii2mod.comments ' , 'Comment ' ),
117+ 'content ' => Yii::t ('yii2mod.comments ' , 'Content ' ),
117118 'entity ' => Yii::t ('yii2mod.comments ' , 'Entity ' ),
119+ 'entityId ' => Yii::t ('yii2mod.comments ' , 'Entity ID ' ),
120+ 'parentId ' => Yii::t ('yii2mod.comments ' , 'Parent ID ' ),
118121 'status ' => Yii::t ('yii2mod.comments ' , 'Status ' ),
119122 'level ' => Yii::t ('yii2mod.comments ' , 'Level ' ),
120123 'createdBy ' => Yii::t ('yii2mod.comments ' , 'Created by ' ),
@@ -168,7 +171,7 @@ public function afterSave($insert, $changedAttributes)
168171 self ::updateAll (['status ' => CommentStatus::DELETED ], ['parentId ' => $ this ->id ]);
169172 }
170173 }
171-
174+
172175 parent ::afterSave ($ insert , $ changedAttributes );
173176 }
174177
@@ -323,9 +326,9 @@ public function getAuthorName()
323326 * @param string $deletedCommentText
324327 * @return string
325328 */
326- public function getContent ($ deletedCommentText = 'Comment was deleted. ' )
329+ public function getContent ($ deletedCommentText = 'Comment has been deleted. ' )
327330 {
328- return $ this ->isDeleted ? $ deletedCommentText : nl2br ($ this ->content );
331+ return $ this ->isDeleted ? Yii:: t ( ' yii2mod.comments ' , $ deletedCommentText) : nl2br ($ this ->content );
329332 }
330333
331334 /**
0 commit comments