. */ /** * IdentificationVariable = identifier * * @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_IdentificationVariable extends Doctrine_Query_Production { protected $_componentAlias; public function syntax($paramHolder) { // IdentificationVariable = identifier $this->_parser->match(Doctrine_Query_Token::T_IDENTIFIER); $this->_componentAlias = $this->_parser->token['value']; } public function semantical($paramHolder) { $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}'" . "for '".$paramHolder->get('componentName')."'. It was already declared for " . "component '{$componentName}'."; $this->_parser->semanticalError($message); } return $this->_componentAlias; } }