yii\sphinx\QueryBuilder::buildFacets PHP Метод

buildFacets() защищенный Метод

protected buildFacets ( array $facets, array &$params ) : string
$facets array facet specifications
$params array the binding parameters to be populated
Результат string the FACET clause build from [[query]]
    protected function buildFacets($facets, &$params)
    {
        if (empty($facets)) {
            return '';
        }
        $sqlParts = [];
        foreach ($facets as $key => $value) {
            if (is_numeric($key)) {
                $facet = ['select' => $value];
            } else {
                if (is_array($value)) {
                    $facet = $value;
                    if (!array_key_exists('select', $facet)) {
                        $facet['select'] = $key;
                    }
                } else {
                    throw new InvalidConfigException('Facet specification must be an array, "' . gettype($value) . '" given.');
                }
            }
            if (!array_key_exists('limit', $facet)) {
                $facet['limit'] = null;
            }
            if (!array_key_exists('offset', $facet)) {
                $facet['offset'] = null;
            }
            $facetSql = 'FACET ' . $this->buildSelectFields((array) $facet['select'], $params);
            if (!empty($facet['order'])) {
                $facetSql .= ' ' . $this->buildOrderBy($facet['order']);
            }
            $facetSql .= ' ' . $this->buildLimit($facet['limit'], $facet['offset']);
            $sqlParts[] = $facetSql;
        }
        return implode($this->separator, $sqlParts);
    }