File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace DoctrineExtensions \Query \Postgresql ;
4+
5+ use Doctrine \ORM \Query \AST \ASTException ;
6+ use Doctrine \ORM \Query \AST \Functions \FunctionNode ;
7+ use Doctrine \ORM \Query \Lexer ;
8+ use Doctrine \ORM \Query \AST \Node ;
9+ use Doctrine \ORM \Query \Parser ;
10+ use Doctrine \ORM \Query \QueryException ;
11+ use Doctrine \ORM \Query \SqlWalker ;
12+
13+ class Ilike extends FunctionNode
14+ {
15+ /** @var Node */
16+ protected $ field ;
17+ /** @var Node */
18+ protected $ query ;
19+
20+ /**
21+ * @param Parser $parser
22+ *
23+ * @throws QueryException
24+ */
25+ public function parse (Parser $ parser )
26+ {
27+ $ parser ->match (Lexer::T_IDENTIFIER );
28+ $ parser ->match (Lexer::T_OPEN_PARENTHESIS );
29+ $ this ->field = $ parser ->StringExpression ();
30+ $ parser ->match (Lexer::T_COMMA );
31+ $ this ->query = $ parser ->StringExpression ();
32+ $ parser ->match (Lexer::T_CLOSE_PARENTHESIS );
33+ }
34+
35+ /**
36+ * @param SqlWalker $sqlWalker
37+ *
38+ * @return string
39+ * @throws ASTException
40+ */
41+ public function getSql (SqlWalker $ sqlWalker )
42+ {
43+ return '( ' . $ this ->field ->dispatch ($ sqlWalker ) . ' ILIKE ' . $ this ->query ->dispatch ($ sqlWalker ) . ') ' ;
44+ }
45+ }
You can’t perform that action at this time.
0 commit comments