Mr. Carl Thu Jan 26 15:52:25 -0500 2012

Subject: How do validate a single model attribute?

How do I validate only a single attribute?

Using the model and validations how do I validate $client_id before passing to Customer::find()?
Because if $client_id = '1_1' will retry customer with id of 1 if exist.

I could do if(strcmp($customer->id, $client_id) != 0) after Customer::find(), however because I already have validations in model why not use it.

Controller client:

 1 public function delete($client_id)
 2 {
 3     //code
 4 
 5     // Find by primary key
 6     // WARNING: Does Type Juggling & Trucking for converting string to int!
 7     $customer = Customer::find($client_id);
 8 
 9     //code
10 }

Model:
1 class Customer extends ActiveRecord\Model
2 {
3     // Code for validates
4 }