mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-11-04 06:37:55 +08:00 
			
		
		
		
	ported fix for #6164 to sphinx
was already supported for BETWEEN but not for LIKE fixes #6164
This commit is contained in:
		@ -6,6 +6,7 @@ Yii Framework 2 sphinx extension Change Log
 | 
			
		||||
 | 
			
		||||
- Bug #5601: Simple conditions in Query::where() and ActiveQuery::where() did not allow `yii\db\Expression` to be used as the value (cebe, stevekr)
 | 
			
		||||
- Bug #5634: Fixed `yii\sphinx\QueryBuilder` does not support comparison operators (>,<,>= etc) in where specification (klimov-paul)
 | 
			
		||||
- Bug #6164: Added missing support for `yii\db\Exression` to QueryBuilder `LIKE` conditions (cebe)
 | 
			
		||||
- Enh #5223: Query builder now supports selecting sub-queries as columns (qiangxue)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -928,7 +928,9 @@ class QueryBuilder extends Object
 | 
			
		||||
 | 
			
		||||
        list($column, $values) = $operands;
 | 
			
		||||
 | 
			
		||||
        $values = (array) $values;
 | 
			
		||||
        if (!is_array($values)) {
 | 
			
		||||
            $values = [$values];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (empty($values)) {
 | 
			
		||||
            return $operator === 'LIKE' || $operator === 'OR LIKE' ? '0=1' : '';
 | 
			
		||||
@ -947,8 +949,15 @@ class QueryBuilder extends Object
 | 
			
		||||
 | 
			
		||||
        $parts = [];
 | 
			
		||||
        foreach ($values as $value) {
 | 
			
		||||
            $phName = self::PARAM_PREFIX . count($params);
 | 
			
		||||
            $params[$phName] = empty($escape) ? $value : ('%' . strtr($value, $escape) . '%');
 | 
			
		||||
            if ($value instanceof Expression) {
 | 
			
		||||
                foreach ($value->params as $n => $v) {
 | 
			
		||||
                    $params[$n] = $v;
 | 
			
		||||
                }
 | 
			
		||||
                $phName = $value->expression;
 | 
			
		||||
            } else {
 | 
			
		||||
                $phName = self::PARAM_PREFIX . count($params);
 | 
			
		||||
                $params[$phName] = empty($escape) ? $value : ('%' . strtr($value, $escape) . '%');
 | 
			
		||||
            }
 | 
			
		||||
            $parts[] = "$column $operator $phName";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -31,7 +31,7 @@ Yii Framework 2 Change Log
 | 
			
		||||
- Bug #6107: `yii message` was emptying existing translations in .po in case of multiple categories (samdark)
 | 
			
		||||
- Bug #6112: `yii message` was incorrectly writing not yet translated strings in .po in case of multiple categories (samdark)
 | 
			
		||||
- Bug #6172: `yii\rbac\DbManager` should properly quote table and column names (qiangxue)
 | 
			
		||||
- Bug #6164: Added missing support for `yii\db\Exression` QueryBuilder `BETWEEN` and `LIKE` conditions (cebe)
 | 
			
		||||
- Bug #6164: Added missing support for `yii\db\Exression` to QueryBuilder `BETWEEN` and `LIKE` conditions (cebe)
 | 
			
		||||
- Bug: Gii console command help information does not contain global options (qiangxue)
 | 
			
		||||
- Bug: `yii\web\UrlRule` was unable to create URLs for rules containing unicode characters (samdark)
 | 
			
		||||
- Enh #4181: Added `yii\bootstrap\Modal::$headerOptions` and `yii\bootstrap\Modal::$footerOptions` (tuxoff, samdark)
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user