Commit c037b481 by Qiang Xue

Added SafeValidator.

parent ac4b8757
<?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)
{
}
}
...@@ -35,6 +35,7 @@ use yii\base\NotSupportedException; ...@@ -35,6 +35,7 @@ use yii\base\NotSupportedException;
* - `integer`: [[NumberValidator]] * - `integer`: [[NumberValidator]]
* - `match`: [[RegularExpressionValidator]] * - `match`: [[RegularExpressionValidator]]
* - `required`: [[RequiredValidator]] * - `required`: [[RequiredValidator]]
* - `safe`: [[SafeValidator]]
* - `string`: [[StringValidator]] * - `string`: [[StringValidator]]
* - `unique`: [[UniqueValidator]] * - `unique`: [[UniqueValidator]]
* - `url`: [[UrlValidator]] * - `url`: [[UrlValidator]]
...@@ -66,6 +67,7 @@ abstract class Validator extends Component ...@@ -66,6 +67,7 @@ abstract class Validator extends Component
'match' => 'yii\validators\RegularExpressionValidator', 'match' => 'yii\validators\RegularExpressionValidator',
'number' => 'yii\validators\NumberValidator', 'number' => 'yii\validators\NumberValidator',
'required' => 'yii\validators\RequiredValidator', 'required' => 'yii\validators\RequiredValidator',
'safe' => 'yii\validators\SafeValidator',
'string' => 'yii\validators\StringValidator', 'string' => 'yii\validators\StringValidator',
'unique' => 'yii\validators\UniqueValidator', 'unique' => 'yii\validators\UniqueValidator',
'url' => 'yii\validators\UrlValidator', 'url' => 'yii\validators\UrlValidator',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment