. */ /** * AliasIdentificationVariable = identifier * * @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_ORM_Query_Parser_AliasIdentificationVariable extends Doctrine_ORM_Query_ParserRule { protected $_AST = null; public function syntax($paramHolder) { // AliasIdentificationVariable = identifier $this->_AST = $this->AST('AliasIdentificationVariable'); $this->_parser->match(Doctrine_ORM_Query_Token::T_IDENTIFIER); $this->_AST->setComponentAlias($this->_parser->token['value']); } public function semantical($paramHolder) { $parserResult = $this->_parser->getParserResult(); if ($parserResult->hasQueryComponent($this->_AST->getComponentAlias())) { // We should throw semantical error if there's already a component for this alias $queryComponent = $parserResult->getQueryComponent($this->_AST->getComponentAlias()); $componentName = $queryComponent['metadata']->getClassName(); $message = "Cannot re-declare component alias '" . $this->_AST->getComponentAlias() . "'. " . "It was already declared for component '" . $componentName . "'."; $this->_parser->semanticalError($message); } return $this->_AST; } }