protected function SqlGroupGraphStorage::insertEdge in Subgroup (Graph) 1.0.x
Relates the parent group to the child group.
This method only creates the relationship from the parent group to the child group and not any of the inferred relationships based on what other relationships the parent group and the child group already have.
Parameters
int $parent_group_id: The ID of the parent group.
int $child_group_id: The ID of the child group.
Return value
int The ID of the new edge relating the parent group to the child group.
1 call to SqlGroupGraphStorage::insertEdge()
- SqlGroupGraphStorage::addEdge in src/
Graph/ SqlGroupGraphStorage.php - Relates the parent group and the child group.
File
- src/
Graph/ SqlGroupGraphStorage.php, line 262
Class
- SqlGroupGraphStorage
- SQL based storage of the group relationship graph.
Namespace
Drupal\ggroup\GraphCode
protected function insertEdge($parent_group_id, $child_group_id) {
$new_edge_id = $this->connection
->insert('group_graph')
->fields([
'start_vertex' => $parent_group_id,
'end_vertex' => $child_group_id,
'hops' => 0,
])
->execute();
$this->connection
->update('group_graph')
->fields([
'entry_edge_id' => $new_edge_id,
'exit_edge_id' => $new_edge_id,
'direct_edge_id' => $new_edge_id,
])
->condition('id', $new_edge_id)
->execute();
return $new_edge_id;
}