/** * * @param Database_Query $db * @param array $clause * @return type */ public static function _conditions($db, array $clause) { foreach ($clause as $type => $params) { switch ($type) { case 'select': foreach ($params as $param) { $db->select($param); } break; case 'where': foreach ($params as $param) { $db->where($param[0], $param[1], $param[2]); } break; case 'or_where': foreach ($params as $param) { $db->or_where($param[0], $param[1], $param[2]); } break; case 'order_by': foreach ($params as $param) { $db->order_by($param[0], $param[1]); } break; case 'limit': $db->limit((int) $params); break; case 'offset': $db->offset((int) $params); break; } } return $db; }