src/wcmf/lib/model/ObjectQuery.php
public function getObjectTemplate($type, $alias=null, $combineOperator=Criteria::OPERATOR_AND) {
    $template = null;

    // use the typeNode, the first time a node template of the query type is requested
    $persistenceFacade = ObjectFactory::getInstance('persistenceFacade');
    $fqType = $persistenceFacade->getFullyQualifiedType($type);
    if ($fqType == $this->typeNode->getType() && !$this->isTypeNodeInQuery) {
      $template = $this->typeNode;
      $this->isTypeNodeInQuery = true;
      // the typeNode is contained already in the rootNodes array
    }
    else {
      // don't use PersistenceFacade::create, because template instances must be transient
      $mapper = self::getMapper($fqType);
      $template = $mapper->create($fqType, BuildDepth::SINGLE);
      $this->rootNodes[] = $template;
    }
    $template->setProperty(self::PROPERTY_COMBINE_OPERATOR, $combineOperator);
    if ($alias != null) {
      $template->setProperty(self::PROPERTY_TABLE_NAME, $alias);
    }
    $initialOid = $template->getOID()->__toString();
    $template->setProperty(self::PROPERTY_INITIAL_OID, $initialOid);
    $this->observedObjects[$initialOid] = $template;
    return $template;
  }
public function getObjectTemplate($type, $alias=null, $combineOperator=Criteria::OPERATOR_AND) {
    $template = null;

    // use the typeNode, the first time a node template of the query type is requested
    $persistenceFacade = ObjectFactory::getInstance('persistenceFacade');
    $fqType = $persistenceFacade->getFullyQualifiedType($type);
    if ($fqType == $this->typeNode->getType() && !$this->isTypeNodeInQuery) {
      $template = $this->typeNode;
      $this->isTypeNodeInQuery = true;
      // the typeNode is contained already in the rootNodes array
    }
    else {
      // don't use PersistenceFacade::create, because template instances must be transient
      $mapper = self::getMapper($fqType);
      $template = $mapper->create($fqType, BuildDepth::SINGLE);
      $this->rootNodes[] = $template;
    }
    $template->setProperty(self::PROPERTY_COMBINE_OPERATOR, $combineOperator);
    if ($alias != null) {
      $template->setProperty(self::PROPERTY_TABLE_NAME, $alias);
    }
    $initialOid = $template->getOID()->__toString();
    $template->setProperty(self::PROPERTY_INITIAL_OID, $initialOid);
    $this->observedObjects[$initialOid] = $template;
    return $template;
  }
public function getObjectTemplate ( $ type , $ alias = null , $ combineOperator = Criteria :: OPERATOR_AND ) { $ template = null ; // use the typeNode, the first time a node template of the query type is requested $ persistenceFacade = ObjectFactory :: getInstance ( 'persistenceFacade' ) ; $ fqType = $ persistenceFacade -> getFullyQualifiedType ( $ type ) ; if ( $ fqType == $ this -> typeNode -> getType ( ) && ! $ this -> isTypeNodeInQuery ) { $ template = $ this -> typeNode ; $ this -> isTypeNodeInQuery = true ; // the typeNode is contained already in the rootNodes array } else { // don't use PersistenceFacade::create, because template instances must be transient $ mapper = self :: getMapper ( $ fqType ) ; $ template = $ mapper -> create ( $ fqType , BuildDepth :: SINGLE ) ; $ this -> rootNodes [ ] = $ template ; } $ template -> setProperty ( self :: PROPERTY_COMBINE_OPERATOR , $ combineOperator ) ; if ( $ alias != null ) { $ template -> setProperty ( self :: PROPERTY_TABLE_NAME , $ alias ) ; } $ initialOid = $ template -> getOID ( ) -> __toString ( ) ; $ template -> setProperty ( self :: PROPERTY_INITIAL_OID , $ initialOid ) ; $ this -> observedObjects [ $ initialOid ] = $ template ; return $ template ; }
Get an object template for a given type.
@param $type The type to query for
@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_)
@return Node
Get an object template for a given type .