File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace Yiisoft \Db \Pgsql \Builder ;
6
+
7
+ use Yiisoft \Db \QueryBuilder \Condition \Interface \LikeConditionInterface ;
8
+
9
+ /**
10
+ * Build an object of {@see LikeConditionInterface} into SQL expressions for PostgreSQL Server.
11
+ */
12
+ final class LikeConditionBuilder extends \Yiisoft \Db \QueryBuilder \Condition \Builder \LikeConditionBuilder
13
+ {
14
+ protected function parseOperator (LikeConditionInterface $ expression ): array
15
+ {
16
+ [$ andor , $ not , $ operator ] = parent ::parseOperator ($ expression );
17
+
18
+ $ operator = match ($ expression ->getCaseSensitive ()) {
19
+ true => 'LIKE ' ,
20
+ false => 'ILIKE ' ,
21
+ default => $ operator ,
22
+ };
23
+
24
+ return [$ andor , $ not , $ operator ];
25
+ }
26
+ }
Original file line number Diff line number Diff line change 12
12
use Yiisoft \Db \Pgsql \Builder \ArrayExpressionBuilder ;
13
13
use Yiisoft \Db \Pgsql \Builder \ArrayOverlapsConditionBuilder ;
14
14
use Yiisoft \Db \Pgsql \Builder \JsonOverlapsConditionBuilder ;
15
+ use Yiisoft \Db \Pgsql \Builder \LikeConditionBuilder ;
15
16
use Yiisoft \Db \Pgsql \Builder \StructuredExpressionBuilder ;
16
17
use Yiisoft \Db \Pgsql \Builder \ExpressionBuilder ;
17
18
use Yiisoft \Db \Pgsql \Builder \JsonExpressionBuilder ;
@@ -62,6 +63,7 @@ protected function defaultExpressionBuilders(): array
62
63
JsonOverlapsCondition::class => JsonOverlapsConditionBuilder::class,
63
64
StructuredExpression::class => StructuredExpressionBuilder::class,
64
65
Expression::class => ExpressionBuilder::class,
66
+ LikeCondition::class => LikeConditionBuilder::class,
65
67
];
66
68
}
67
69
}
You can’t perform that action at this time.
0 commit comments