src/wcmf/lib/model/Node.php
public function getParentsEx(ObjectId $oid=null, $role=null, $type=null, $values=null,
          $properties=null, $useRegExp=true) {
    if ($role != null) {
      // nodes of a given role are requested
      // make sure it is a parent role
      $parentRoles = $this->getPossibleParents();
      if (!isset($parentRoles[$role])) {
        throw new IllegalArgumentException("No parent role defined with name: ".$role);
      }
      // we are only looking for nodes that are in memory already
      $nodes = parent::getValue($role);
      if (!is_array($nodes)) {
        $nodes = [$nodes];
      }
      // sort out proxies
      $parents = [];
      foreach($nodes as $curNode) {
        if ($curNode instanceof PersistentObject) {
          $parents[] = $curNode;
        }
      }
      return self::filter($parents, $oid, $type, $values, $properties, $useRegExp);
    }
    else {
      return self::filter($this->getParents(), $oid, $type, $values, $properties, $useRegExp);
    }
  }
public function getParentsEx(ObjectId $oid=null, $role=null, $type=null, $values=null,
          $properties=null, $useRegExp=true) {
    if ($role != null) {
      // nodes of a given role are requested
      // make sure it is a parent role
      $parentRoles = $this->getPossibleParents();
      if (!isset($parentRoles[$role])) {
        throw new IllegalArgumentException("No parent role defined with name: ".$role);
      }
      // we are only looking for nodes that are in memory already
      $nodes = parent::getValue($role);
      if (!is_array($nodes)) {
        $nodes = [$nodes];
      }
      // sort out proxies
      $parents = [];
      foreach($nodes as $curNode) {
        if ($curNode instanceof PersistentObject) {
          $parents[] = $curNode;
        }
      }
      return self::filter($parents, $oid, $type, $values, $properties, $useRegExp);
    }
    else {
      return self::filter($this->getParents(), $oid, $type, $values, $properties, $useRegExp);
    }
  }
public function getParentsEx ( ObjectId $ oid = null , $ role = null , $ type = null , $ values = null , $ properties = null , $ useRegExp = true ) { if ( $ role != null ) { // nodes of a given role are requested // make sure it is a parent role $ parentRoles = $ this -> getPossibleParents ( ) ; if ( ! isset ( $ parentRoles [ $ role ] ) ) { throw new IllegalArgumentException ( "No parent role defined with name: " . $ role ) ; } // we are only looking for nodes that are in memory already $ nodes = parent :: getValue ( $ role ) ; if ( ! is_array ( $ nodes ) ) { $ nodes = [ $ nodes ] ; } // sort out proxies $ parents = [ ] ; foreach ( $ nodes as $ curNode ) { if ( $ curNode instanceof PersistentObject ) { $ parents [ ] = $ curNode ; } } return self :: filter ( $ parents , $ oid , $ type , $ values , $ properties , $ useRegExp ) ; } else { return self :: filter ( $ this -> getParents ( ) , $ oid , $ type , $ values , $ properties , $ useRegExp ) ; } }
Get the parents that match given conditions.
@note This method will only return objects that are already loaded, to get all objects in
the given relation (including proxies), use the Node::getValue() method and filter the returned
list afterwards.
@param $oid The object id that the parent should match (optional, default: _null_).
@param $role The role that the parents should match (optional, default: _null_).
@param $type The type that the parents should match (either fully qualified or simple, if not ambiguous)
(optional, default: _null_).
@param $values An associative array holding key value pairs that the parent values should match (optional, default: _null_).
@param $properties An associative array holding key value pairs that the parent properties should match (optional, default: _null_).
@param $useRegExp Boolean whether to interpret the given values/properties as regular expressions or not (default: _true_)
@return Array containing parent Nodes that matched (proxies not included).
Get the parents that match given conditions .