lib/Doctrine/ORM/Query/SqlWalker.php
public function walkSimpleCaseExpression($simpleCaseExpression)
    {
        $sql = 'CASE ' . $this->walkStateFieldPathExpression($simpleCaseExpression->caseOperand);

        foreach ($simpleCaseExpression->simpleWhenClauses as $simpleWhenClause) {
            $sql .= ' WHEN ' . $this->walkSimpleArithmeticExpression($simpleWhenClause->caseScalarExpression);
            $sql .= ' THEN ' . $this->walkSimpleArithmeticExpression($simpleWhenClause->thenScalarExpression);
        }

        $sql .= ' ELSE ' . $this->walkSimpleArithmeticExpression($simpleCaseExpression->elseScalarExpression) . ' END';

        return $sql;
    }
public function walkSimpleCaseExpression($simpleCaseExpression)
    {
        $sql = 'CASE ' . $this->walkStateFieldPathExpression($simpleCaseExpression->caseOperand);

        foreach ($simpleCaseExpression->simpleWhenClauses as $simpleWhenClause) {
            $sql .= ' WHEN ' . $this->walkSimpleArithmeticExpression($simpleWhenClause->caseScalarExpression);
            $sql .= ' THEN ' . $this->walkSimpleArithmeticExpression($simpleWhenClause->thenScalarExpression);
        }

        $sql .= ' ELSE ' . $this->walkSimpleArithmeticExpression($simpleCaseExpression->elseScalarExpression) . ' END';

        return $sql;
    }
public function walkSimpleCaseExpression ( $ simpleCaseExpression ) { $ sql = 'CASE ' . $ this -> walkStateFieldPathExpression ( $ simpleCaseExpression -> caseOperand ) ; foreach ( $ simpleCaseExpression -> simpleWhenClauses as $ simpleWhenClause ) { $ sql .= ' WHEN ' . $ this -> walkSimpleArithmeticExpression ( $ simpleWhenClause -> caseScalarExpression ) ; $ sql .= ' THEN ' . $ this -> walkSimpleArithmeticExpression ( $ simpleWhenClause -> thenScalarExpression ) ; } $ sql .= ' ELSE ' . $ this -> walkSimpleArithmeticExpression ( $ simpleCaseExpression -> elseScalarExpression ) . ' END' ; return $ sql ; }
Walks down a SimpleCaseExpression AST node and generates the corresponding SQL.

@param AST\SimpleCaseExpression $simpleCaseExpression

@return string The SQL.
Walks down a SimpleCaseExpression AST node and generates the corresponding SQL .