You are here

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

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

Parameters

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

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

Return value

bool TRUE if group A is a descendant of group B.

Overrides GroupGraphStorageInterface::isDescendant

1 call to SqlGroupGraphStorage::isDescendant()
SqlGroupGraphStorage::addEdge in src/Graph/SqlGroupGraphStorage.php
Relates the parent group and the child group.

File

src/Graph/SqlGroupGraphStorage.php, line 553

Class

SqlGroupGraphStorage
SQL based storage of the group relationship graph.

Namespace

Drupal\ggroup\Graph

Code

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