Example #1
0
 public function __construct(array &$data_array, $values_array)
 {
     parent::__construct($data_array);
     Validator::validateUnknownColumns($data_array, $values_array);
     $this->data_array =& $data_array;
     $this->values_array = $values_array;
 }
Example #2
0
 private function applyConditions($current, $filter)
 {
     $match = TRUE;
     foreach ($filter->getConditionsAnd() as $value) {
         Validator::validateUnknownColumns($current, array($value[0] => NULL));
         if (!$value[2]->match($current[$value[0]], $value[1], $current)) {
             $match = FALSE;
         }
     }
     if (!$match) {
         return FALSE;
     }
     if (count($filter->getConditionsOr()) === 0) {
         return TRUE;
     }
     $match = FALSE;
     foreach ($filter->getConditionsOr() as $value) {
         Validator::validateUnknownColumns($current, array($value[0] => NULL));
         if ($value[2]->match($current[$value[0]], $value[1], $current)) {
             $match = TRUE;
         }
     }
     return $match;
 }
Example #3
0
 private function applyColumns($data)
 {
     if (!$this->validate_columns) {
         $arr = array_flip($this->column_array);
         unset($arr['*']);
         Validator::validateUnknownColumns($this->data_array, $arr);
         $this->validate_columns = TRUE;
     }
     if (empty($this->column_array) || array_search('*', $this->column_array) !== FALSE) {
         return $data;
     } else {
         $current_data = array();
         foreach ($this->column_array as $key) {
             $current_data[$key] = $data[$key];
         }
         return $current_data;
     }
 }