src/wcmf/lib/model/ObjectQuery.php
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;
      }
    }
  }
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;
      }
    }
  }
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 ; } } }
Register an object template at the query.
@param $template Node instance to register as template
@param $alias An alias name to be used in the query. if null, use the default name (default: _null_)
@param $combineOperator One of the Criteria::OPERATOR constants that precedes
the conditions described in the template (default: Criteria::OPERATOR_AND)
Register an object template at the query .