/**
  * validates fields
  */
 public function validate()
 {
     $table = new \PSU_Oracle_Table('gxrdird');
     $table->validate(get_object_vars($this), 'gxrdird_');
     $alpha_numeric_filter = array('options' => array('regexp' => '/^[a-zA-Z0-9]+$/'));
     $extended_alpha_numeric_filter = array('options' => array('regexp' => '/^[a-zA-Z0-9.-_]+$/'));
     $alpha_numeric = array('status', 'doc_type', 'ap_ind', 'hr_ind', 'ach_iat_ind', 'acct_type', 'atyp_code', 'scod_code_iso', 'acht_code', 'atyp_code_iat');
     $extended_alpha_numeric = array('user_id', 'bank_acct_num', 'bank_rout_num');
     // enforce alpha numeric
     foreach ($alpha_numeric as $field) {
         if (isset($this->{$field}) && filter_var($this->{$field}, FILTER_VALIDATE_REGEXP, $alpha_numeric_filter) === false) {
             throw new \Exception('Direct Deposit ' . $field . ' field must be alpha numeric');
         }
         //end if
     }
     //end foreach
     // enforce alpha numeric PLUS .-_
     foreach ($extended_alpha_numeric as $field) {
         if (isset($this->{$field}) && filter_var($this->{$field}, FILTER_VALIDATE_REGEXP, $extended_alpha_numeric_filter) === false) {
             throw new \Exception('Direct Deposit ' . $field . ' field must be a valid username');
         }
         //end if
     }
     //end foreach
     return true;
 }
 /**
  * validates fields for the given table.  This validation is basic
  * NULL & type checking.
  *
  * @param array $args The data to validate. Defaults to $this.
  */
 public function validate($table_name, $args = null)
 {
     $table = new PSU_Oracle_Table($table_name);
     if (!isset($args)) {
         $args = $this;
     }
     $table->validate($args, $table_name . '_');
 }
示例#3
0
 /**
  * constructor
  *
  * @param $table \b table the update/insert will be done against
  * @param $db \b database to connect to
  */
 public function __construct($table, $db = 'banner')
 {
     $this->db = $db;
     $this->_key = $table;
     // retrieve the possible pieces of the table
     $parsed = PSU_Oracle_Table::name_parse($table);
     $this->table = $parsed['table'];
     $this->owner = $parsed['owner'];
     $this->link = $parsed['link'];
 }