title: Yii 'Unique' Validator in CFormModel
body: <p>I have this small line of code in Yii Framework:</p>
  
  <pre><code>array('username', 'unique', 'attributeName'=&gt; 'username', 'caseSensitive' =&gt; 'false'),
  </code></pre>
  
  <p>that gives me an error:</p>
  
  <pre><code>RegisterForm and its behaviors do not have a method or closure named "tableName".
  </code></pre>
  
  <p>The full RegisterForm.php model:</p>
  
  <pre><code>&lt;?php
  class RegisterForm extends CFormModel
  {
      public $username;
      public $password;
      public $password2;
      public $email;
      public $fullname;
      public $birth;
  
      public function rules()
      {
          return array(
              array('username, password, password2, email, fullname, birth', 'required'),
  
              array('username','length','min'=&gt;3),
              array('username','length','max'=&gt;16),
              array('username', 'filter', 'filter'=&gt;'strtolower'),
              array('username', 'ext.alpha', 'allowSpaces'=&gt;'flase', 'allAccentedLetters'=&gt;'false'),
              array('username', 'unique', 'attributeName'=&gt; 'username', 'caseSensitive' =&gt; 'false'),
  
              array('password', 'length', 'min' =&gt;6),
              array('password', 'length', 'max' =&gt;32),
              array('password', 'compare', 'allowEmpty' =&gt; 'false', 'compareAttribute' =&gt; 'password2', 'strict' =&gt; 'true'),
  
              array('email', 'length', 'min' =&gt;8),
              array('email', 'length', 'max' =&gt;128),
              array('email', 'email'),
  
              array('fullname','length','min'=&gt;6),
              array('fullname','length','max'=&gt;64),
              array('fullname', 'ext.alpha', 'allowNumbers'=&gt;'false', 'allAccentedLetters'=&gt;'false'),
  
              array('birth', 'date', 'allowEmpty'=&gt;'false', 'format'=&gt;'dd/MM/yyyy'),
          );
      }
  }
  </code></pre>