In this post I will show an example of how apply the unique validation rule in CakePHP 1.2. It’s very important to do in some cases, like saving users. You must make sure that the username is unique in your system. Lets see how it works:
var $validate = array( 'username' => array( 'rule' => array('isUnique'), 'message' => 'Username already in use.' ) );
I wrote a custom function to validate it, but thanks to Dia now I know the built-in validation rule.