Typo in Documentation

In the Working with forms documentation: Creating Model

http://www.yiiframework.com/doc/guide/1.1/en/form.model

I got a bit confused with @param bits in the code snippet (a quarter of the way down) under

"There are three ways to specify Validator in a validation rule. First, Validator can be the name of a method in the model class, like authenticate in the above example. The validator method must be of the following signature:"

/**

  • @param string the name of the attribute to be validated

  • @param array options specified in the validation rule

*/

public function ValidatorName($attribute,$params) { … }

Shouldn’t this say …

/**

  • @attribute string the name of the attribute to be validated

  • @params array options specified in the validation rule

*/

public function ValidatorName($attribute,$params) { … }

?

Hi and welcome to the yii forum

@param is a phpdoc tag - http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_tags.param.pkg.html

To show the attribute name the example should be like:




/**

 * @param string $attribute the name of the attribute to be validated

 * @param array $params options specified in the validation rule

 */

public function ValidatorName($attribute,$params) { ... }

I will update this… but it will be visible only on the next yii release as only then the documentation is updated

/* moved - not a tip, snippet or tutorial */