public function registerObjectTemplate(Node $template, $alias=null, $combineOperator=Criteria::OPERATOR_AND) {
    if ($template != null) {
      $initialOid = $template->getOID();
      $initialOidStr = $initialOid->__toString();
      $template->setProperty(self::PROPERTY_INITIAL_OID, $initialOidStr);
      $this->observedObjects[$initialOidStr] = $template;

      // call the setters for all attributes in order to register them in the query
      $includePKs = !ObjectId::isDummyId($initialOid->getFirstId());
      $template->copyValues($template, $includePKs);

      $template->setProperty(self::PROPERTY_COMBINE_OPERATOR, $combineOperator);
      if ($alias != null) {
        $template->setProperty(self::PROPERTY_TABLE_NAME, $alias);
      }

      // replace the typeNode, the first time a node template of the query type is registered
      if ($template->getType() == $this->typeNode->getType() && !$this->isTypeNodeInQuery) {
        $newRootNodes = [$template];
        foreach($this->rootNodes as $node) {
          if ($node != $this->typeNode) {
            $newRootNodes[] = $node;
          }
        }
        $this->rootNodes = $newRootNodes;
        $this->isTypeNodeInQuery = true;
      }
      else {
        $this->rootNodes[] = $template;
      }
    }
  }