@@ 1576-1591 (lines=16) @@ | ||
1573 | * |
|
1574 | * @return \Doctrine\ORM\Query\AST\GeneralCaseExpression |
|
1575 | */ |
|
1576 | public function GeneralCaseExpression() { |
|
1577 | $this->match(Lexer::T_CASE); |
|
1578 | ||
1579 | // Process WhenClause (1..N) |
|
1580 | $whenClauses = array(); |
|
1581 | ||
1582 | do { |
|
1583 | $whenClauses[] = $this->WhenClause(); |
|
1584 | } while ($this->lexer->isNextToken(Lexer::T_WHEN)); |
|
1585 | ||
1586 | $this->match(Lexer::T_ELSE); |
|
1587 | $scalarExpression = $this->ScalarExpression(); |
|
1588 | $this->match(Lexer::T_END); |
|
1589 | ||
1590 | return new AST\GeneralCaseExpression($whenClauses, $scalarExpression); |
|
1591 | } |
|
1592 | ||
1593 | /** |
|
1594 | * SimpleCaseExpression ::= "CASE" CaseOperand SimpleWhenClause {SimpleWhenClause}* "ELSE" ScalarExpression "END" |
|
@@ 1599-1615 (lines=17) @@ | ||
1596 | * |
|
1597 | * @return AST\SimpleCaseExpression |
|
1598 | */ |
|
1599 | public function SimpleCaseExpression() { |
|
1600 | $this->match(Lexer::T_CASE); |
|
1601 | $caseOperand = $this->StateFieldPathExpression(); |
|
1602 | ||
1603 | // Process SimpleWhenClause (1..N) |
|
1604 | $simpleWhenClauses = array(); |
|
1605 | ||
1606 | do { |
|
1607 | $simpleWhenClauses[] = $this->SimpleWhenClause(); |
|
1608 | } while ($this->lexer->isNextToken(Lexer::T_WHEN)); |
|
1609 | ||
1610 | $this->match(Lexer::T_ELSE); |
|
1611 | $scalarExpression = $this->ScalarExpression(); |
|
1612 | $this->match(Lexer::T_END); |
|
1613 | ||
1614 | return new AST\SimpleCaseExpression($caseOperand, $simpleWhenClauses, $scalarExpression); |
|
1615 | } |
|
1616 | ||
1617 | /** |
|
1618 | * WhenClause ::= "WHEN" ConditionalExpression "THEN" ScalarExpression |