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