mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 22:32:40 +08:00
Fix from e719ff5 moved to yii\sphinx\Query
This commit is contained in:
@ -4,7 +4,7 @@ Yii Framework 2 sphinx extension Change Log
|
||||
2.0.2 under development
|
||||
-----------------------
|
||||
|
||||
- no changes in this release.
|
||||
- Bug #6621: Creating sub query at `yii\sphinx\Query::queryScalar()` fixed (klimov-paul)
|
||||
|
||||
|
||||
2.0.1 December 07, 2014
|
||||
|
||||
@ -366,6 +366,34 @@ class Query extends \yii\db\Query
|
||||
->queryColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function queryScalar($selectExpression, $db)
|
||||
{
|
||||
$select = $this->select;
|
||||
$limit = $this->limit;
|
||||
$offset = $this->offset;
|
||||
|
||||
$this->select = [$selectExpression];
|
||||
$this->limit = null;
|
||||
$this->offset = null;
|
||||
$command = $this->createCommand($db);
|
||||
|
||||
$this->select = $select;
|
||||
$this->limit = $limit;
|
||||
$this->offset = $offset;
|
||||
|
||||
if (empty($this->groupBy) && empty($this->union) && !$this->distinct) {
|
||||
return $command->queryScalar();
|
||||
} else {
|
||||
return (new Query)->select([$selectExpression])
|
||||
->from(['c' => $this])
|
||||
->createCommand($command->db)
|
||||
->queryScalar();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Query object and copies its property values from an existing one.
|
||||
* The properties being copies are the ones to be used by query builders.
|
||||
|
||||
Reference in New Issue
Block a user