. */ /** * BetweenExpression = ["NOT"] "BETWEEN" Expression "AND" Expression * * @package Doctrine * @subpackage Query * @author Guilherme Blanco * @author Janne Vanhala * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://www.phpdoctrine.org * @since 2.0 * @version $Revision$ */ class Doctrine_Query_Production_BetweenExpression extends Doctrine_Query_Production { protected $_not; protected $_fromExpression; protected $_toExpression; public function syntax($paramHolder) { // BetweenExpression = ["NOT"] "BETWEEN" Expression "AND" Expression $this->_not = false; if ($this->_isNextToken(Doctrine_Query_Token::T_NOT)) { $this->_parser->match(Doctrine_Query_Token::T_NOT); $this->_not = true; } $this->_parser->match(Doctrine_Query_Token::T_BETWEEN); $this->_fromExpression = $this->AST('Expression', $paramHolder); $this->_parser->match(Doctrine_Query_Token::T_AND); $this->_toExpression = $this->AST('Expression', $paramHolder); } public function buildSql() { return (($this->_not) ? 'NOT ' : '') . 'BETWEEN ' . $this->_fromExpression->buildSql() . ' AND ' . $this->_toExpression->buildSql(); } /* Getters */ public function isNot() { return $this->_not; } public function getFromExpression() { return $this->_fromExpression; } public function getToExpression() { return $this->_toExpression; } }