src/wcmf/lib/model/NodeUtil.php
public static function getConnections($type, $otherRole, $otherType, $hierarchyType='all') {
    $paths = [];
    self::getConnectionsImpl($type, $otherRole, $otherType, $hierarchyType, $paths);
    $minLength = -1;
    $shortestPaths = [];
    foreach ($paths as $curPath) {
      $curLength = $curPath->getPathLength();
      if ($minLength == -1 || $minLength > $curLength) {
        $minLength = $curLength;
        $shortestPaths = [$curPath];
      }
      elseif ($curLength == $minLength) {
        $shortestPaths[] = $curPath;
      }
    }
    return $shortestPaths;
  }
public static function getConnections($type, $otherRole, $otherType, $hierarchyType='all') {
    $paths = [];
    self::getConnectionsImpl($type, $otherRole, $otherType, $hierarchyType, $paths);
    $minLength = -1;
    $shortestPaths = [];
    foreach ($paths as $curPath) {
      $curLength = $curPath->getPathLength();
      if ($minLength == -1 || $minLength > $curLength) {
        $minLength = $curLength;
        $shortestPaths = [$curPath];
      }
      elseif ($curLength == $minLength) {
        $shortestPaths[] = $curPath;
      }
    }
    return $shortestPaths;
  }
public static function getConnections ( $ type , $ otherRole , $ otherType , $ hierarchyType = 'all' ) { $ paths = [ ] ; self :: getConnectionsImpl ( $ type , $ otherRole , $ otherType , $ hierarchyType , $ paths ) ; $ minLength = - 1 ; $ shortestPaths = [ ] ; foreach ( $ paths as $ curPath ) { $ curLength = $ curPath -> getPathLength ( ) ; if ( $ minLength == - 1 || $ minLength > $ curLength ) { $ minLength = $ curLength ; $ shortestPaths = [ $ curPath ] ; } elseif ( $ curLength == $ minLength ) { $ shortestPaths [ ] = $ curPath ; } } return $ shortestPaths ; }
Get the shortest paths that connect a type to another type.
@param $type The type to start from
@param $otherRole The role of the type at the other end (maybe null, if only type shoudl match)
@param $otherType The type at the other end (maybe null, if only role shoudl match)
@param $hierarchyType The hierarchy type that the other type has in relation to this type
'parent', 'child', 'undefined' or 'all' to get all relations (default: 'all')
@return An array of PathDescription instances
Get the shortest paths that connect a type to another type .