public static function buildCriteria(array $values, $qmMode = false)
    {
        reset($values);
        $qmMode = $qmMode ?: is_numeric(key($values));

        if ($qmMode) {
            $result = array_values($values);
            array_unshift($result, str_repeat('?,', count($values)-1).'?');

            return $result;
        }

        $result = [''];
        foreach ($values as $key => $value) {
            $key = ":$key";
            $result[0] .= ($result[0]?',':'').$key;
            $result[$key] = $value;
        }

        return $result;
    }