You are here

public function SqlGroupGraphStorage::isDirectAncestor in Subgroup (Graph) 1.0.x

Checks if a group (A) is the ancestor of another group (B).

Parameters

int $a: The group whose ancestry status will be checked.

int $b: The group for which ancestry status will be checked against.

Return value

bool TRUE if group A is an ancestor of group B.

Overrides GroupGraphStorageInterface::isDirectAncestor

File

src/Graph/SqlGroupGraphStorage.php, line 545

Class

SqlGroupGraphStorage
SQL based storage of the group relationship graph.

Namespace

Drupal\ggroup\Graph

Code

public function isDirectAncestor($a, $b) {
  $this
    ->loadMap($b);
  return isset($this->directAncestors[$b]) ? in_array($a, $this->directAncestors[$b]) : FALSE;
}