Exemplo n.º 1
0
 public static function add_query_where(\Orm\Query $query, $conditions = array())
 {
     if (!$conditions) {
         return $query;
     }
     if (count($conditions) == 3) {
         $query->where($conditions[0], $conditions[1], $conditions[2]);
     } else {
         $query->where($conditions);
     }
     return $query;
 }
Exemplo n.º 2
0
 protected static function set_where4not_multi(\Orm\Query $query, $params = array())
 {
     if (!$params) {
         return $query;
     }
     if (\Arr::is_assoc($params)) {
         $query->where($params);
         return $query;
     }
     if (count($params) == 2) {
         $query->where($params[0], $params[1]);
     } elseif (count($params) == 3) {
         $query->where($params[0], $params[1], $params[2]);
     } else {
         throw new \InvalidArgumentException('Second parameter is invalid.');
     }
     return $query;
 }