src/wcmf/lib/model/mapper/impl/AbstractRDBMapper.php
protected function addRelatedObjects(array $objects, $buildDepth=BuildDepth::SINGLE) {
    // recalculate build depth for the next generation
    $newBuildDepth = $buildDepth;
    if ($buildDepth != BuildDepth::SINGLE && $buildDepth != BuildDepth::INFINITE && $buildDepth > 0) {
      $newBuildDepth = $buildDepth-1;
    }
    $loadNextGeneration = (($buildDepth != BuildDepth::SINGLE) && ($buildDepth > 0 || $buildDepth == BuildDepth::INFINITE));

    // get dependend objects of this object
    $relationDescs = $this->getRelations();
    foreach($relationDescs as $relationDesc) {
      $role = $relationDesc->getOtherRole();

      $relationId = $role.$relationDesc->getThisRole();
      // if the build depth is not satisfied already and the relation is not
      // currently loading, we load the complete objects and add them
      if ($loadNextGeneration && !isset($this->loadingRelations[$relationId])) {
        $this->loadingRelations[$relationId] = true;
        $relatives = $this->loadRelation($objects, $role, $newBuildDepth);
        // set the values
        foreach ($objects as $object) {
          $oidStr = $object->getOID()->__toString();
          $object->setValue($role, isset($relatives[$oidStr]) ? $relatives[$oidStr] : null, true, false);
        }
        unset($this->loadingRelations[$relationId]);
      }
      // otherwise set the value to not initialized.
      // the Node will initialize it with the proxies for the relation objects
      // on first access
      else {
        foreach ($objects as $object) {
          if ($object instanceof Node) {
            $object->addRelation($role);
          }
        }
      }
    }
  }
protected function addRelatedObjects(array $objects, $buildDepth=BuildDepth::SINGLE) {
    // recalculate build depth for the next generation
    $newBuildDepth = $buildDepth;
    if ($buildDepth != BuildDepth::SINGLE && $buildDepth != BuildDepth::INFINITE && $buildDepth > 0) {
      $newBuildDepth = $buildDepth-1;
    }
    $loadNextGeneration = (($buildDepth != BuildDepth::SINGLE) && ($buildDepth > 0 || $buildDepth == BuildDepth::INFINITE));

    // get dependend objects of this object
    $relationDescs = $this->getRelations();
    foreach($relationDescs as $relationDesc) {
      $role = $relationDesc->getOtherRole();

      $relationId = $role.$relationDesc->getThisRole();
      // if the build depth is not satisfied already and the relation is not
      // currently loading, we load the complete objects and add them
      if ($loadNextGeneration && !isset($this->loadingRelations[$relationId])) {
        $this->loadingRelations[$relationId] = true;
        $relatives = $this->loadRelation($objects, $role, $newBuildDepth);
        // set the values
        foreach ($objects as $object) {
          $oidStr = $object->getOID()->__toString();
          $object->setValue($role, isset($relatives[$oidStr]) ? $relatives[$oidStr] : null, true, false);
        }
        unset($this->loadingRelations[$relationId]);
      }
      // otherwise set the value to not initialized.
      // the Node will initialize it with the proxies for the relation objects
      // on first access
      else {
        foreach ($objects as $object) {
          if ($object instanceof Node) {
            $object->addRelation($role);
          }
        }
      }
    }
  }
protected function addRelatedObjects ( array $ objects , $ buildDepth = BuildDepth :: SINGLE ) { // recalculate build depth for the next generation $ newBuildDepth = $ buildDepth ; if ( $ buildDepth != BuildDepth :: SINGLE && $ buildDepth != BuildDepth :: INFINITE && $ buildDepth > 0 ) { $ newBuildDepth = $ buildDepth - 1 ; } $ loadNextGeneration = ( ( $ buildDepth != BuildDepth :: SINGLE ) && ( $ buildDepth > 0 || $ buildDepth == BuildDepth :: INFINITE ) ) ; // get dependend objects of this object $ relationDescs = $ this -> getRelations ( ) ; foreach ( $ relationDescs as $ relationDesc ) { $ role = $ relationDesc -> getOtherRole ( ) ; $ relationId = $ role . $ relationDesc -> getThisRole ( ) ; // if the build depth is not satisfied already and the relation is not // currently loading, we load the complete objects and add them if ( $ loadNextGeneration && ! isset ( $ this -> loadingRelations [ $ relationId ] ) ) { $ this -> loadingRelations [ $ relationId ] = true ; $ relatives = $ this -> loadRelation ( $ objects , $ role , $ newBuildDepth ) ; // set the values foreach ( $ objects as $ object ) { $ oidStr = $ object -> getOID ( ) -> __toString ( ) ; $ object -> setValue ( $ role , isset ( $ relatives [ $ oidStr ] ) ? $ relatives [ $ oidStr ] : null , true , false ) ; } unset ( $ this -> loadingRelations [ $ relationId ] ) ; } // otherwise set the value to not initialized. // the Node will initialize it with the proxies for the relation objects // on first access else { foreach ( $ objects as $ object ) { if ( $ object instanceof Node ) { $ object -> addRelation ( $ role ) ; } } } } }
Append the child data to a list of object. If the buildDepth does not determine to load a
child generation, only the oids of the children will be loaded.
@param $objects Array of PersistentObject instances to append the children to
@param $buildDepth @see PersistenceFacade::loadObjects()
Append the child data to a list of object . If the buildDepth does not determine to load a child generation only the oids of the children will be loaded .