• romanb's avatar
    [2.0] Parser work. Added double-dispatch functionality to AST node classes for... · ae5d2122
    romanb authored
    [2.0] Parser work. Added double-dispatch functionality to AST node classes for use in the SqlWalker to reduce big if/else instanceof checks and for better maintainability. Also its less error-prone in the SqlWalker because its harder to miss a conditional case. Added new extensible DQL function implementation.
    ae5d2122
BetweenExpression.php 1.13 KB
<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

namespace Doctrine\ORM\Query\AST;

/**
 * Description of BetweenExpression
 *
 * @author robo
 */
class BetweenExpression extends Node
{
    private $_baseExpression;
    private $_leftBetweenExpression;
    private $_rightBetweenExpression;
    private $_not;

    public function __construct($baseExpr, $leftExpr, $rightExpr)
    {
        $this->_baseExpression = $baseExpr;
        $this->_leftBetweenExpression = $leftExpr;
        $this->_rightBetweenExpression = $rightExpr;
    }

    public function getBaseExpression()
    {
        return $this->_baseExpression;
    }

    public function getLeftBetweenExpression()
    {
        return $this->_leftBetweenExpression;
    }

    public function getRightBetweenExpression()
    {
        return $this->_rightBetweenExpression;
    }

    public function setNot($bool)
    {
        $this->_not = $bool;
    }

    public function getNot()
    {
        return $this->_not;
    }

    public function dispatch($sqlWalker)
    {
        return $sqlWalker->walkBetweenExpression($this);
    }
}