. */ /** * JoinVariableDeclaration = Join [IndexBy] * * @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_JoinVariableDeclaration extends Doctrine_Query_Production { protected $_join; protected $_indexBy; public function syntax($paramHolder) { $this->_join = $this->AST('Join', $paramHolder); if ($this->_isNextToken(Doctrine_Query_Token::T_INDEX)) { $paramHolder->set('componentAlias', $this->_join->getRangeVariableDeclaration()->getIdentificationVariable()); $this->_indexBy = $this->AST('IndexBy', $paramHolder); $paramHolder->remove('componentAlias'); } } public function buildSql() { return $this->_join->buildSql() . (isset($this->_indexby) ? $this->_indexby->buildSql() . ' ' : ''); } /* Getters */ public function getJoin() { return $this->_join; } public function getIndexBy() { return $this->_indexBy; } }