Beispiel #1
0
 /**
  * @param $record
  * @return array
  */
 protected static function _generateConditionsArray($record)
 {
     if (is_array($record['filter']) && count($record['filter']) > 0) {
         $where = '';
         $relation = $record['filter_relation'];
         foreach ($record['filter'] as $config) {
             $key = $config['field'];
             $value = $config['value'];
             //get direct operator
             $operator = '=';
             if (isset($config['operator'])) {
                 $operator = Qdmvc_Helper::getOperator($config['operator']);
             }
             //filter invalue
             if (isset($config['filterkind']) && $config['filterkind'] == 'invalue') {
                 $where .= static::_genSingleWhereClause($key, $value, $relation, $operator);
             } else {
                 $where .= static::_genSingleWhereClause($key, $value, $relation, $operator);
             }
         }
         if (strtoupper($relation) == 'AND') {
             $where .= '1=1';
             //trick to avoid SQL exception
         } else {
             $where .= '1=2';
             //trick to avoid SQL exception
         }
         return array($where);
     }
     return array();
 }