. */ namespace Doctrine\ORM\Query\AST; /** * StateFieldPathExpression ::= SimpleStateFieldPathExpression | SimpleStateFieldAssociationPathExpression * * @author robo */ class StateFieldPathExpression extends Node { //const TYPE_COLLECTION_VALUED_ASSOCIATION = 1; //const TYPE_SINGLE_VALUED_ASSOCIATION = 2; //const TYPE_STATE_FIELD = 3; //private $_type; private $_parts; // Information that is attached during semantical analysis. private $_isSimpleStateFieldPathExpression = false; private $_isSimpleStateFieldAssociationPathExpression = false; private $_embeddedClassFields = array(); private $_singleValuedAssociationFields = array(); private $_collectionValuedAssociationFields = array(); public function __construct(array $parts) { $this->_parts = $parts; } public function getParts() { return $this->_parts; } /** * Gets whether the path expression represents a state field that is reached * either directly (u.name) or by navigating over optionally many embedded class instances * (u.address.zip). * * @return boolean */ public function isSimpleStateFieldPathExpression() { return $this->_isSimpleStateFieldPathExpression; } /** * Gets whether the path expression represents a state field that is reached * by navigating over at least one single-valued association and optionally * many embedded class instances. (u.Group.address.zip, u.Group.address, ...) * * @return boolean */ public function isSimpleStateFieldAssociationPathExpression() { return $this->_isSimpleStateFieldAssociationPathExpression; } public function isPartEmbeddedClassField($part) { return isset($this->_embeddedClassFields[$part]); } public function isPartSingleValuedAssociationField($part) { return isset($this->_singleValuedAssociationFields[$part]); } public function isPartCollectionValuedAssociationField($part) { return isset($this->_collectionValuedAssociationFields[$part]); } /* Setters to attach semantical information during semantical analysis. */ public function setIsSimpleStateFieldPathExpression($bool) { $this->_isSimpleStateFieldPathExpression = $bool; } public function setIsSimpleStateFieldAssociationPathExpression($bool) { $this->_isSimpleStateFieldAssociationPathExpression = $bool; } public function setIsEmbeddedClassPart($part) { $this->_embeddedClassFields[$part] = true; } public function setIsSingleValuedAssociationPart($part) { $this->_singleValuedAssociationFields[$part] = true; } public function setIsCollectionValuedAssociationPart($part) { $this->_collectionValuedAssociationFields[$part] = true; } public function dispatch($sqlWalker) { return $sqlWalker->walkStateFieldPathExpression($this); } }