. */ namespace Doctrine\ORM\Query\AST; /** * SelectClause = "SELECT" ["DISTINCT"] SelectExpression {"," SelectExpression} * * @author Guilherme Blanco * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://www.doctrine-project.org * @since 2.0 * @version $Revision$ */ class SelectClause extends Node { protected $_isDistinct; protected $_selectExpressions = array(); public function __construct(array $selectExpressions, $isDistinct) { $this->_isDistinct = $isDistinct; $this->_selectExpressions = $selectExpressions; } /* 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 is_object($value) ? $value->buildSql() : $value; } public function dispatch($sqlWalker) { return $sqlWalker->walkSelectClause($this); } }