예제 #1
0
 /**
  * Automatically generate rules from X2Model.
  *
  * The "required" validator is excluded because, when validating input for a
  * default value for a field that is required, blank should be a valid value
  * because otherwise having the field be required would force the user to
  * specify a non-blank default value.
  * @return array
  */
 public function rules()
 {
     $rules = X2Model::modelRules($this->_mockFields, $this);
     foreach (array_keys($rules) as $ind) {
         if (in_array($rules[$ind][1], array('required', 'unique', 'application.components.ValidLinkValidator'))) {
             unset($rules[$ind]);
         }
     }
     return $rules;
 }