Browse Source

Added SafeValidator.

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
c037b481e8
  1. 24
      framework/yii/validators/SafeValidator.php
  2. 2
      framework/yii/validators/Validator.php

24
framework/yii/validators/SafeValidator.php

@ -0,0 +1,24 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\validators;
/**
* SafeValidator serves as a dummy validator whose main purpose is to mark the attributes to be safe for massive assignment.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class SafeValidator extends Validator
{
/**
* @inheritdoc
*/
public function validateAttribute($object, $attribute)
{
}
}

2
framework/yii/validators/Validator.php

@ -35,6 +35,7 @@ use yii\base\NotSupportedException;
* - `integer`: [[NumberValidator]]
* - `match`: [[RegularExpressionValidator]]
* - `required`: [[RequiredValidator]]
* - `safe`: [[SafeValidator]]
* - `string`: [[StringValidator]]
* - `unique`: [[UniqueValidator]]
* - `url`: [[UrlValidator]]
@ -66,6 +67,7 @@ abstract class Validator extends Component
'match' => 'yii\validators\RegularExpressionValidator',
'number' => 'yii\validators\NumberValidator',
'required' => 'yii\validators\RequiredValidator',
'safe' => 'yii\validators\SafeValidator',
'string' => 'yii\validators\StringValidator',
'unique' => 'yii\validators\UniqueValidator',
'url' => 'yii\validators\UrlValidator',

Loading…
Cancel
Save