protected function hasCircularReferences($parent, $visited = array()){
		foreach($parent->subqueries as $child){
			if(isset($visited[spl_object_hash($child)]))
				return true;
			$visited[spl_object_hash($child)] = true;
			if($this->hasCircularReferences($child, $visited))
				return true;
			array_pop($visited);
		}
		return false;
	}