src/wcmf/lib/model/Node.php
public function getRelatives($hierarchyType, $memOnly=true) {
    $relatives = [];
    $relations = $this->getRelations($hierarchyType);
    foreach ($relations as $curRelation) {
      $curRelatives = null;
      if ($memOnly) {
        $curRelatives = parent::getValue($curRelation->getOtherRole());
      }
      else {
        $curRelatives = $this->getValue($curRelation->getOtherRole());
      }
      if (!$curRelatives) {
        continue;
      }
      if (!is_array($curRelatives)) {
        $curRelatives = [$curRelatives];
      }
      foreach ($curRelatives as $curRelative) {
        if ($curRelative instanceof PersistentObjectProxy && $memOnly) {
          // ignore proxies
          continue;
        }
        else {
          $relatives[] = $curRelative;
        }
      }
    }
    return $relatives;
  }
public function getRelatives($hierarchyType, $memOnly=true) {
    $relatives = [];
    $relations = $this->getRelations($hierarchyType);
    foreach ($relations as $curRelation) {
      $curRelatives = null;
      if ($memOnly) {
        $curRelatives = parent::getValue($curRelation->getOtherRole());
      }
      else {
        $curRelatives = $this->getValue($curRelation->getOtherRole());
      }
      if (!$curRelatives) {
        continue;
      }
      if (!is_array($curRelatives)) {
        $curRelatives = [$curRelatives];
      }
      foreach ($curRelatives as $curRelative) {
        if ($curRelative instanceof PersistentObjectProxy && $memOnly) {
          // ignore proxies
          continue;
        }
        else {
          $relatives[] = $curRelative;
        }
      }
    }
    return $relatives;
  }
public function getRelatives ( $ hierarchyType , $ memOnly = true ) { $ relatives = [ ] ; $ relations = $ this -> getRelations ( $ hierarchyType ) ; foreach ( $ relations as $ curRelation ) { $ curRelatives = null ; if ( $ memOnly ) { $ curRelatives = parent :: getValue ( $ curRelation -> getOtherRole ( ) ) ; } else { $ curRelatives = $ this -> getValue ( $ curRelation -> getOtherRole ( ) ) ; } if ( ! $ curRelatives ) { continue ; } if ( ! is_array ( $ curRelatives ) ) { $ curRelatives = [ $ curRelatives ] ; } foreach ( $ curRelatives as $ curRelative ) { if ( $ curRelative instanceof PersistentObjectProxy && $ memOnly ) { // ignore proxies continue ; } else { $ relatives [ ] = $ curRelative ; } } } return $ relatives ; }
Get the relatives of a given hierarchyType.
@param $hierarchyType @see PersistenceMapper::getRelations
@param $memOnly Boolean whether to only get the relatives in memory or all relatives (including proxies) (default: _true_).
@return An array containing the relatives.
Get the relatives of a given hierarchyType .