public function selectinput($params) { $method = isset($params['init']) ? 'one' : 'all'; // Меняем раскладку на английскую при вводе МКБ10 if ($method === 'all') { preg_match('/^([а-яА-Я]\\d)/ui', $params['q'], $match); if (!empty($match[1])) { $params['q'] = Proc::switcher($params['q']); } } $query = self::find()->select(array_merge(isset($params['init']) ? [] : [self::primaryKey()[0] . ' AS id'], ['CONCAT_WS(" - ", code, name) AS text']))->where(['node_count' => 0])->andwhere(['or', ['like', isset($params['init']) ? 'id' : 'code', $params['q'], isset($params['init']) ? false : null], $method === 'all' ? ['like', 'name', $params['q']] : '1<>1'])->andwhere(['or', ['like', 'code', 'H40%', false], ['like', 'code', 'Q15.0', false]])->limit(10)->asArray()->{$method}(); return $query; }