. */ /** * FieldAliasIdentificationVariable ::= 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_FieldAliasIdentificationVariable extends Doctrine_ORM_Query_Parser { protected $_fieldAlias = null; public function syntax() { // AliasIdentificationVariable = identifier $this->_parser->match(Doctrine_ORM_Query_Token::T_IDENTIFIER); $this->_fieldAlias = $this->_parser->token['value']; } public function semantical() { $parserResult = $this->_parser->getParserResult(); if ($parserResult->hasFieldAlias($this->_fieldAlias)) { // We should throw semantical error if there's already a field for this alias $message = "Cannot re-declare field alias '" . $this->_fieldAlias . "' near '" . $this->_parser->getQueryPiece($this->_parser->token) . "'."; $this->_parser->semanticalError($message); } return $this->_fieldAlias; } }