@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorEdgeGraph extends AbstractDirectedGraph {
4
5 private $edgeType;
6
7 public function setEdgeType($edge_type) {
8 $this->edgeType = $edge_type;
9 return $this;
10 }
11
12 protected function loadEdges(array $nodes) {
13 if (!$this->edgeType) {
14 throw new Exception(pht('Set edge type before loading graph!'));
15 }
16
17 $edges = id(new PhabricatorEdgeQuery())
18 ->withSourcePHIDs($nodes)
19 ->withEdgeTypes(array($this->edgeType))
20 ->execute();
21
22 $results = array_fill_keys($nodes, array());
23 foreach ($edges as $src => $types) {
24 foreach ($types as $type => $dsts) {
25 foreach ($dsts as $dst => $edge) {
26 $results[$src][] = $dst;
27 }
28 }
29 }
30
31 return $results;
32 }
33
34}