Browse Source

Fix phpdoc of `yii\base\Model` (#18888)

tags/2.0.44
Anton 3 years ago committed by GitHub
parent
commit
d6632a8367
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      framework/base/Model.php

21
framework/base/Model.php

@ -335,9 +335,9 @@ class Model extends Component implements StaticInstanceInterface, IteratorAggreg
* Errors found during the validation can be retrieved via [[getErrors()]],
* [[getFirstErrors()]] and [[getFirstError()]].
*
* @param string[]|string $attributeNames attribute name or list of attribute names that should be validated.
* If this parameter is empty, it means any attribute listed in the applicable
* validation rules should be validated.
* @param string[]|string|null $attributeNames attribute name or list of attribute names
* that should be validated. If this parameter is empty, it means any attribute listed in
* the applicable validation rules should be validated.
* @param bool $clearErrors whether to call [[clearErrors()]] before performing validation
* @return bool whether the validation is successful without any error.
* @throws InvalidArgumentException if the current scenario is unknown.
@ -426,7 +426,7 @@ class Model extends Component implements StaticInstanceInterface, IteratorAggreg
/**
* Returns the validators applicable to the current [[scenario]].
* @param string $attribute the name of the attribute whose applicable validators should be returned.
* @param string|null $attribute the name of the attribute whose applicable validators should be returned.
* If this is null, the validators for ALL attributes in the model will be returned.
* @return \yii\validators\Validator[] the validators applicable to the current [[scenario]].
*/
@ -561,10 +561,9 @@ class Model extends Component implements StaticInstanceInterface, IteratorAggreg
/**
* Returns the errors for all attributes or a single attribute.
* @param string $attribute attribute name. Use null to retrieve errors for all attributes.
* @property array An array of errors for all attributes. Empty array is returned if no error.
* The result is a two-dimensional array. See [[getErrors()]] for detailed description.
* @param string|null $attribute attribute name. Use null to retrieve errors for all attributes.
* @return array errors for all attributes or the specified attribute. Empty array is returned if no error.
* See [[getErrors()]] for detailed description.
* Note that when returning errors for all attributes, the result is a two-dimensional array, like the following:
*
* ```php
@ -704,7 +703,7 @@ class Model extends Component implements StaticInstanceInterface, IteratorAggreg
/**
* Returns attribute values.
* @param array $names list of attributes whose value needs to be returned.
* @param array|null $names list of attributes whose value needs to be returned.
* Defaults to null, meaning all attributes listed in [[attributes()]] will be returned.
* If it is an array, only the attributes in the array will be returned.
* @param array $except list of attributes whose value should NOT be returned.
@ -857,7 +856,7 @@ class Model extends Component implements StaticInstanceInterface, IteratorAggreg
* Note, that the data being populated is subject to the safety check by [[setAttributes()]].
*
* @param array $data the data array to load, typically `$_POST` or `$_GET`.
* @param string $formName the form name to use to load the data into the model.
* @param string|null $formName the form name to use to load the data into the model, empty string when form not use.
* If not set, [[formName()]] is used.
* @return bool whether `load()` found the expected form in `$data`.
*/
@ -887,7 +886,7 @@ class Model extends Component implements StaticInstanceInterface, IteratorAggreg
* @param array $models the models to be populated. Note that all models should have the same class.
* @param array $data the data array. This is usually `$_POST` or `$_GET`, but can also be any valid array
* supplied by end user.
* @param string $formName the form name to be used for loading the data into the models.
* @param string|null $formName the form name to be used for loading the data into the models.
* If not set, it will use the [[formName()]] value of the first model in `$models`.
* This parameter is available since version 2.0.1.
* @return bool whether at least one of the models is successfully populated.
@ -923,7 +922,7 @@ class Model extends Component implements StaticInstanceInterface, IteratorAggreg
* This method will validate every model. The models being validated may
* be of the same or different types.
* @param array $models the models to be validated
* @param array $attributeNames list of attribute names that should be validated.
* @param array|null $attributeNames list of attribute names that should be validated.
* If this parameter is empty, it means any attribute listed in the applicable
* validation rules should be validated.
* @return bool whether all models are valid. False will be returned if one

Loading…
Cancel
Save