Input validation: use other attributes

I would like to create a validation rule that uses several input values to determine the result.

As I understand, a model method wouldn't do in this case as it knows only of the one specific attribute being checked at the moment. So I would like to create a validation class.

Which place would be the correct one to place that custom validation class?

You can place the validator class anywhere (e.g. protected/components). Then in the rules() you can refer to it using:

array('attribute', '')

In your validator class, you can access $this->attributes to get the list of attributes to be validated.

Thank you for the answer! I just saw that there is 'validators' folder for the framework, but I didn't have such folder in my auto-generated application structure.

As I said, you can put it in protected/components.