Commit 01e5ffdc by Qiang Xue

guide WIP [skip ci]

parent 25f919c1
...@@ -173,6 +173,7 @@ Special Topics ...@@ -173,6 +173,7 @@ Special Topics
* [Advanced Application Template](tutorial-advanced-app.md) * [Advanced Application Template](tutorial-advanced-app.md)
* [Building Application from Scratch](tutorial-start-from-scratch.md) * [Building Application from Scratch](tutorial-start-from-scratch.md)
* [Console Commands](tutorial-console.md) * [Console Commands](tutorial-console.md)
* [Core Validators](tutorial-core-validators.md)
* [Internationalization](tutorial-i18n.md) * [Internationalization](tutorial-i18n.md)
* [Mailing](tutorial-mailing.md) * [Mailing](tutorial-mailing.md)
* [Performance Tuning](tutorial-performance-tuning.md) * [Performance Tuning](tutorial-performance-tuning.md)
......
Working with forms Working with Forms
================== ==================
> Note: This section is under development. > Note: This section is under development.
......
...@@ -19,15 +19,16 @@ namespace yii\validators; ...@@ -19,15 +19,16 @@ namespace yii\validators;
class DefaultValueValidator extends Validator class DefaultValueValidator extends Validator
{ {
/** /**
* @var mixed a PHP callable returning the default value or the default value to be set to the specified attributes. * @var mixed the default value or a PHP callable that returns the default value which will
* The function signature must be as follows, * be assigned to the attributes being validated if they are empty. The signature of the PHP callable
* should be as follows,
* *
* ~~~ * ```php
* function foo($object, $attribute) { * function foo($model, $attribute) {
* // compute value * // compute value
* return $value; * return $value;
* } * }
* ~~~ * ```
*/ */
public $value; public $value;
/** /**
......
...@@ -37,8 +37,8 @@ class EmailValidator extends Validator ...@@ -37,8 +37,8 @@ class EmailValidator extends Validator
*/ */
public $allowName = false; public $allowName = false;
/** /**
* @var boolean whether to check whether the emails domain exists and has either an A or MX record. * @var boolean whether to check whether the email's domain exists and has either an A or MX record.
* Be aware of the fact that this check can fail due to temporary DNS problems even if the email address is * Be aware that this check can fail due to temporary DNS problems even if the email address is
* valid and an email would be deliverable. Defaults to false. * valid and an email would be deliverable. Defaults to false.
*/ */
public $checkDNS = false; public $checkDNS = false;
......
...@@ -61,7 +61,6 @@ class ExistValidator extends Validator ...@@ -61,7 +61,6 @@ class ExistValidator extends Validator
* is the [[\yii\db\Query|Query]] object that you can modify in the function. * is the [[\yii\db\Query|Query]] object that you can modify in the function.
*/ */
public $filter; public $filter;
/** /**
* @var boolean whether to allow array type attribute. * @var boolean whether to allow array type attribute.
*/ */
......
...@@ -52,10 +52,10 @@ class ImageValidator extends FileValidator ...@@ -52,10 +52,10 @@ class ImageValidator extends FileValidator
*/ */
public $maxHeight; public $maxHeight;
/** /**
* @var array|string a list of file mime types that are allowed to be uploaded. * @var array|string a list of file MIME types that are allowed to be uploaded.
* This can be either an array or a string consisting of file mime types * This can be either an array or a string consisting of file MIME types
* separated by space or comma (e.g. "image/jpeg, image/png"). * separated by space or comma (e.g. "image/jpeg, image/png").
* Mime type names are case-insensitive. Defaults to null, meaning all mime types * Mime type names are case-insensitive. Defaults to null, meaning all MIME types
* are allowed. * are allowed.
* @see wrongMimeType * @see wrongMimeType
*/ */
......
...@@ -76,6 +76,7 @@ class Validator extends Component ...@@ -76,6 +76,7 @@ class Validator extends Component
'trim' => [ 'trim' => [
'class' => 'yii\validators\FilterValidator', 'class' => 'yii\validators\FilterValidator',
'filter' => 'trim', 'filter' => 'trim',
'skipOnArray' => true,
], ],
'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