Completed
Push — 2.1 ( 1e24d9...76e6a2 )
by Dmitry
66:20 queued 62:56
created

SafeValidator::validateAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 0
cts 2
cp 0
cc 1
eloc 1
nc 1
nop 2
crap 2
1
<?php
2
/**
3
 * @link http://www.yiiframework.com/
4
 * @copyright Copyright (c) 2008 Yii Software LLC
5
 * @license http://www.yiiframework.com/license/
6
 */
7
8
namespace yii\validators;
9
10
/**
11
 * SafeValidator serves as a dummy validator whose main purpose is to mark the attributes to be safe for massive assignment.
12
 *
13
 * This class is required because of the way in which Yii determines whether a property is safe for massive assignment, that is,
14
 * when a user submits form data to be loaded into a model directly from the POST data, is it ok for a property to be copied.
15
 * In many cases, this is required but because sometimes properties are internal and you do not want the POST data to be able to
16
 * override these internal values (especially things like database row ids), Yii assumes all values are unsafe for massive assignment
17
 * unless a validation rule exists for the property, which in most cases it will. Sometimes, however, an item is safe for massive assigment but
18
 * does not have a validation rule associated with it - for instance, due to no validation being performed, in which case, you use this class
19
 * as a validation rule for that property. Although it has no functionality, it allows Yii to determine that the property is safe to copy.
20
 *
21
 * @author Qiang Xue <[email protected]>
22
 * @since 2.0
23
 */
24
class SafeValidator extends Validator
25
{
26
    /**
27
     * @inheritdoc
28
     */
29 2
    public function validateAttributes($model, $attributes = null)
30
    {
31 2
    }
32
33
    /**
34
     * @inheritdoc
35
     */
36
    public function validateAttribute($model, $attribute)
37
    {
38
    }
39
}
40