1 | <?php |
||||||
2 | /** |
||||||
3 | * @link http://www.yiiframework.com/ |
||||||
4 | * @copyright Copyright (c) 2008 Yii Software LLC |
||||||
5 | * @license http://www.yiiframework.com/license/ |
||||||
6 | */ |
||||||
7 | |||||||
8 | namespace yii\db\conditions; |
||||||
9 | |||||||
10 | use yii\db\ExpressionBuilderInterface; |
||||||
11 | use yii\db\ExpressionBuilderTrait; |
||||||
12 | use yii\db\ExpressionInterface; |
||||||
13 | |||||||
14 | /** |
||||||
15 | * Class BetweenConditionBuilder builds objects of [[BetweenCondition]] |
||||||
16 | * |
||||||
17 | * @author Dmytro Naumenko <[email protected]> |
||||||
18 | * @since 2.0.14 |
||||||
19 | */ |
||||||
20 | class BetweenConditionBuilder implements ExpressionBuilderInterface |
||||||
21 | { |
||||||
22 | use ExpressionBuilderTrait; |
||||||
23 | |||||||
24 | |||||||
25 | /** |
||||||
26 | * Method builds the raw SQL from the $expression that will not be additionally |
||||||
27 | * escaped or quoted. |
||||||
28 | * |
||||||
29 | * @param ExpressionInterface|BetweenCondition $expression the expression to be built. |
||||||
30 | * @param array $params the binding parameters. |
||||||
31 | * @return string the raw SQL that will not be additionally escaped or quoted. |
||||||
32 | */ |
||||||
33 | 35 | public function build(ExpressionInterface $expression, array &$params = []) |
|||||
34 | { |
||||||
35 | 35 | $operator = $expression->getOperator(); |
|||||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
36 | 35 | $column = $expression->getColumn(); |
|||||
0 ignored issues
–
show
The method
getColumn() does not exist on yii\db\ExpressionInterface . It seems like you code against a sub-type of yii\db\ExpressionInterface such as yii\db\Query or yii\db\Expression or yii\db\conditions\InCondition or yii\db\conditions\BetweenCondition or yii\db\conditions\SimpleCondition .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
37 | |||||||
38 | 35 | if (strpos($column, '(') === false) { |
|||||
39 | 35 | $column = $this->queryBuilder->db->quoteColumnName($column); |
|||||
40 | } |
||||||
41 | |||||||
42 | 35 | $phName1 = $this->createPlaceholder($expression->getIntervalStart(), $params); |
|||||
0 ignored issues
–
show
The method
getIntervalStart() does not exist on yii\db\ExpressionInterface . It seems like you code against a sub-type of yii\db\ExpressionInterface such as yii\db\Query or yii\db\Expression or yii\db\conditions\BetweenCondition .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
43 | 35 | $phName2 = $this->createPlaceholder($expression->getIntervalEnd(), $params); |
|||||
0 ignored issues
–
show
The method
getIntervalEnd() does not exist on yii\db\ExpressionInterface . It seems like you code against a sub-type of yii\db\ExpressionInterface such as yii\db\Query or yii\db\Expression or yii\db\conditions\BetweenCondition .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
44 | |||||||
45 | 35 | return "$column $operator $phName1 AND $phName2"; |
|||||
46 | } |
||||||
47 | |||||||
48 | /** |
||||||
49 | * Attaches $value to $params array and returns placeholder. |
||||||
50 | * |
||||||
51 | * @param mixed $value |
||||||
52 | * @param array $params passed by reference |
||||||
53 | * @return string |
||||||
54 | */ |
||||||
55 | 35 | protected function createPlaceholder($value, &$params) |
|||||
56 | { |
||||||
57 | 35 | if ($value instanceof ExpressionInterface) { |
|||||
58 | 20 | return $this->queryBuilder->buildExpression($value, $params); |
|||||
59 | } |
||||||
60 | |||||||
61 | 25 | return $this->queryBuilder->bindParam($value, $params); |
|||||
62 | } |
||||||
63 | } |
||||||
64 |