mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-24 18:51:27 +08:00
test and docs to be clear about #4558
This commit is contained in:
@@ -385,7 +385,6 @@ class Model extends Component implements IteratorAggregate, ArrayAccess, Arrayab
|
||||
if ($this->_validators === null) {
|
||||
$this->_validators = $this->createValidators();
|
||||
}
|
||||
|
||||
return $this->_validators;
|
||||
}
|
||||
|
||||
@@ -404,7 +403,6 @@ class Model extends Component implements IteratorAggregate, ArrayAccess, Arrayab
|
||||
$validators[] = $validator;
|
||||
}
|
||||
}
|
||||
|
||||
return $validators;
|
||||
}
|
||||
|
||||
@@ -427,7 +425,6 @@ class Model extends Component implements IteratorAggregate, ArrayAccess, Arrayab
|
||||
throw new InvalidConfigException('Invalid validation rule: a rule must specify both attribute names and validator type.');
|
||||
}
|
||||
}
|
||||
|
||||
return $validators;
|
||||
}
|
||||
|
||||
@@ -436,6 +433,12 @@ class Model extends Component implements IteratorAggregate, ArrayAccess, Arrayab
|
||||
* This is determined by checking if the attribute is associated with a
|
||||
* [[\yii\validators\RequiredValidator|required]] validation rule in the
|
||||
* current [[scenario]].
|
||||
*
|
||||
* Note that when the validator has a conditional validation applied using
|
||||
* [[\yii\validators\RequiredValidator::$when|$when]] this method will return
|
||||
* `false` regardless of the `when` condition because it may be called be
|
||||
* before the model is loaded with data.
|
||||
*
|
||||
* @param string $attribute attribute name
|
||||
* @return boolean whether the attribute is required
|
||||
*/
|
||||
@@ -446,7 +449,6 @@ class Model extends Component implements IteratorAggregate, ArrayAccess, Arrayab
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -482,7 +484,6 @@ class Model extends Component implements IteratorAggregate, ArrayAccess, Arrayab
|
||||
public function getAttributeLabel($attribute)
|
||||
{
|
||||
$labels = $this->attributeLabels();
|
||||
|
||||
return isset($labels[$attribute]) ? $labels[$attribute] : $this->generateAttributeLabel($attribute);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user