Ejemplo n.º 1
0
 /**
  * Get the validation rules for the model.
  *
  * This override adds the role_name rule for updates.
  *
  * @uses $empty_validation_rules Observer to generate validation rules if
  * they are empty.
  *
  * @param string $type The type of validation rules to retrieve: 'update' or
  * 'insert'. If 'insert', appends rules set in $insert_validation_rules.
  *
  * @return array    The validation rules for the model or an empty array.
  */
 public function get_validation_rules($type = 'update')
 {
     if ($type != 'update') {
         return parent::get_validation_rules($type);
     }
     // When updating, add the role_name update rule.
     $validationRules = parent::get_validation_rules($type);
     $validationRules = array_merge($validationRules, $this->updateValidationRules);
     return $validationRules;
 }