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

buildAndCondition() публичный Метод

Connects two or more SQL expressions with the AND or OR operator.
public buildAndCondition ( IndexSchema[] $indexes, string $operator, array $operands, array &$params ) : string
$indexes IndexSchema[] list of indexes, which affected by query
$operator string the operator to use for connecting the given operands
$operands array the SQL expressions to connect.
$params array the binding parameters to be populated
Результат string the generated SQL expression
    public function buildAndCondition($indexes, $operator, $operands, &$params)
    {
        $parts = [];
        foreach ($operands as $operand) {
            if (is_array($operand)) {
                $operand = $this->buildCondition($indexes, $operand, $params);
            }
            if ($operand !== '') {
                $parts[] = $operand;
            }
        }
        if (!empty($parts)) {
            return '(' . implode(") {$operator} (", $parts) . ')';
        } else {
            return '';
        }
    }