You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					37 lines
				
				780 B
			
		
		
			
		
	
	
					37 lines
				
				780 B
			| 
											7 years ago
										 | <?php
 | ||
|  | 
 | ||
|  | namespace common\modules\blog\forms;
 | ||
|  | 
 | ||
|  | use common\modules\blog\entities\BlogComment;
 | ||
|  | use yii\base\Model;
 | ||
|  | use Yii;
 | ||
|  | 
 | ||
|  | class BlogCommentEditForm extends Model
 | ||
|  | {
 | ||
|  |     public $parentId;
 | ||
|  |     public $text;
 | ||
|  | 
 | ||
|  |     public function __construct(BlogComment $comment, $config = [])
 | ||
|  |     {
 | ||
|  |         $this->parentId = $comment->parent_id;
 | ||
|  |         $this->text = $comment->text;
 | ||
|  |         parent::__construct($config);
 | ||
|  |     }
 | ||
|  | 
 | ||
|  |     public function rules(): array
 | ||
|  |     {
 | ||
|  |         return [
 | ||
|  |             [['text'], 'required'],
 | ||
|  |             ['text', 'string'],
 | ||
|  |             ['parentId', 'integer'],
 | ||
|  |         ];
 | ||
|  |     }
 | ||
|  | 
 | ||
|  |     public function attributeLabels()
 | ||
|  |     {
 | ||
|  |         return [
 | ||
|  |             'parentId' => Yii::t('blog', 'Parent Comment ID'),
 | ||
|  |             'text' => Yii::t('blog', 'Comment'),
 | ||
|  |         ];
 | ||
|  |     }
 | ||
|  | }
 |