. */ /** * SelectClause = "SELECT" ["DISTINCT"] SelectExpression {"," SelectExpression} * * @author Guilherme Blanco * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://www.phpdoctrine.org * @since 2.0 * @version $Revision$ */ class Doctrine_ORM_Query_AST_SelectClause extends Doctrine_ORM_Query_AST { protected $_isDistinct; protected $_selectExpressions = array(); /* Setters */ public function setIsDistinct($value) { $this->_isDistinct = $value; } public function addSelectExpression($expression) { $this->_selectExpressions[] = $expression; } public function setSelectExpressions($expressions, $append = false) { $this->_selectExpressions = ($append === true) ? array_merge($this->_selectExpressions, $expressions) : $expressions; } /* Getters */ public function isDistinct() { return $this->_isDistinct; } public function getSelectExpressions() { return $this->_selectExpressions; } /* REMOVE ME LATER. COPIED METHODS FROM SPLIT OF PRODUCTION INTO "AST" AND "PARSER" */ public function buildSql() { return 'SELECT ' . (($this->_isDistinct) ? 'DISTINCT ' : '') . implode(', ', $this->_mapSelectExpressions()); } protected function _mapSelectExpressions() { return array_map(array(&$this, '_mapSelectExpression'), $this->_selectExpressions); } protected function _mapSelectExpression($value) { return $value->buildSql(); } }