. */ /** * UpdateItem = PathExpression "=" (Expression | "NULL") * * @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_UpdateItem extends Doctrine_Query_Production { protected $_pathExpression; protected $_expression; public function syntax($paramHolder) { // UpdateItem = PathExpression "=" (Expression | "NULL") $this->_pathExpression = $this->AST('PathExpression', $paramHolder); $this->_parser->match('='); if ($this->_isNextToken(Doctrine_Query_Token::T_NULL)) { $this->_parser->match(Doctrine_Query_Token::T_NULL); $this->_expression = null; } else { $this->_expression = $this->AST('Expression', $paramHolder); } } public function buildSql() { return $this->_pathExpression->buildSql() . ' = ' . ($this->_expression === null ? 'NULL' : $this->_expression->buildSql()); } /** * Visitor support. */ public function accept($visitor) { $this->_pathExpression->accept($visitor); if ($this->_expression) { $this->_expression->accept($visitor); } $visitor->visitUpdateItem($this); } /* Getters */ public function getPathExpression() { return $this->_pathExpression; } public function getExpression() { return $this->_expression; } }