. */ /** * FieldIdentificationVariable = identifier * * @package Doctrine * @subpackage Query * @author Janne Vanhala * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://www.phpdoctrine.org * @since 1.0 * @version $Revision$ */ class Doctrine_Query_Production_FieldIdentificationVariable extends Doctrine_Query_Production { protected $_componentAlias; public function syntax($paramHolder) { // FieldIdentificationVariable = identifier $this->_parser->match(Doctrine_Query_Token::T_IDENTIFIER); $this->_fieldAlias = $this->_parser->token['value']; } public function semantical($paramHolder) { $parserResult = $this->_parser->getParserResult(); if ($parserResult->hasQueryField($this->_fieldAlias)) { // We should throw semantical error if there's already a component for this alias $queryComponent = $parserResult->getQueryField($this->_fieldAlias); $fieldName = $queryComponent['fieldName']; $message = "Cannot re-declare field alias '{$this->_fieldAlias}'" . "for '".$paramHolder->get('fieldName')."'. It was already declared for " . "field '{$fieldName}'."; $this->_parser->semanticalError($message); } } }