How to obtain attribute value in a custom Validation method

I am trying to use a method in the model class to validate four fields of similar nature. The signature in the rules() method is something like:

public function rules()


    return array(

         array('field1, field2, field3, field4', 'nameRule'));


I use the method signature as defined in Yii guide:

public function nameRule($attribute, $params)




how do we access the value of the $attribute field in this method? The name of the attribute is passed each time as string to this method, but the value is not passed…

You can get the value with