You are here

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

Gets all ancestor parent groups of the given child group.

Parameters

int $group_id: The child group ID.

Return value

int[] An array of ancestor parent group IDs.

Overrides GroupGraphStorageInterface::getAncestors

File

src/Graph/SqlGroupGraphStorage.php, line 529

Class

SqlGroupGraphStorage
SQL based storage of the group relationship graph.

Namespace

Drupal\ggroup\Graph

Code

public function getAncestors($group_id) {
  $this
    ->loadMap($group_id);
  return isset($this->ancestors[$group_id]) ? $this->ancestors[$group_id] : [];
}