/** * @param string $attributeName * @return string[]|int[] */ public function getRange($attributeName) { $attribute = $this->model->getAttributesBehavior()->getAttributeInfo($attributeName); /** @var ActiveRecord $modelClass */ $modelClass = $this->query->modelClass; $tableName = $modelClass::tableName(); /* Если такой параметр не описан, то будет взят список из таблицы */ if (!$attribute) { $query = $modelClass::find(); $query->select([$attributeName]); $query->groupBy([$attributeName]); $query->filterWhere(['and', ['not', $attributeName, null], ['>', new Expression('LENGTH(TRIM(' . $attributeName . '))'), 0]]); $result = $query->createCommand()->cache(300)->queryAll(); $return = []; foreach ($result as $row) { $return[] = $row[$attributeName]; } return $return; } return null; }