1 | <?php |
||
19 | class ModelValidator extends Validator |
||
20 | { |
||
21 | /** |
||
22 | * @var array list of attribute names that should be validated. |
||
23 | * If this parameter is empty, it means any attribute listed in the applicable |
||
24 | * validation rules should be validated. |
||
25 | */ |
||
26 | public $modelAttributeNames = null; |
||
27 | |||
28 | /** |
||
29 | * @var bool whether to call [[clearErrors()]] before performing validation |
||
30 | */ |
||
31 | public $clearErrors = true; |
||
32 | |||
33 | /** |
||
34 | * @var string the scenario used to validate the model. |
||
35 | * Defaults to null, meaning no limit. |
||
36 | * @see tooSmall for the customized message for a file that is too small. |
||
37 | */ |
||
38 | public $scenario; |
||
39 | |||
40 | /** |
||
41 | * Validates a value. |
||
42 | * A validator class can implement this method to support data validation out of the context of a data model. |
||
43 | * @param mixed $value the data value to be validated. |
||
44 | * @return array|null the error message and the parameters to be inserted into the error message. |
||
45 | * Null should be returned if the data is valid. |
||
46 | */ |
||
47 | protected function validateValue($value) |
||
66 | |||
67 | /** |
||
68 | * @param array $models |
||
69 | * @return bool |
||
70 | */ |
||
71 | protected function validateModels(array $models): bool |
||
83 | |||
84 | /** |
||
85 | * @param Model $model |
||
86 | * @return bool |
||
87 | */ |
||
88 | protected function validateModel(Model $model): bool |
||
111 | } |
||
112 |