Editing Edges
- public function addEdge($src, $type, $dst, $options) — Add a new edge (possibly also adding its inverse). Changes take effect when you call @{method:save}. If the edge already exists, it will not be overwritten, but if data is attached to the edge it will be updated. Removals queued with @{method:removeEdge} are executed before adds, so the effect of removing and adding the same edge is to overwrite any existing edge.
- public function removeEdge($src, $type, $dst) — Remove an edge (possibly also removing its inverse). Changes take effect when you call @{method:save}. If an edge does not exist, the removal will be ignored. Edges are added after edges are removed, so the effect of a remove plus an add is to overwrite.
- public function save() — Apply edge additions and removals queued by @{method:addEdge} and @{method:removeEdge}. Note that transactions are opened, all additions and removals are executed, and then transactions are saved. Thus, in some cases it may be slightly more efficient to perform multiple edit operations (e.g., adds followed by removals) if their outcomes are not dependent, since transactions will not be held open as long.
Cycle Prevention
Internals
- private function buildEdgeSpecs($src, $type, $dst, $options) — Build the specification for an edge operation, and possibly build its inverse as well.
- private function writeEdgeData() — Write edge data.
- private function executeAdds() — Add queued edges.
- private function executeRemoves() — Remove queued edges.
- private function saveTransactions() — Save open transactions.
Other Methods
- public function __get($name)
- public function __set($name, $value)
- public function current()
- public function key()
- public function next()
- public function rewind()
- public function valid()
- private function throwOnAttemptedIteration()
- public function getPhobjectClassConstant($key, $byte_limit) — Read the value of a class constant.
- private function killTransactions()
cycle
- private function getPreventCyclesEdgeTypes() — Get a list of all edge types which are being added, and which we should prevent cycles on.
- private function detectCycles($phids, $edge_type) — Detect graph cycles of a given edge type. If the edit introduces a cycle, a @{class:PhabricatorEdgeCycleException} is thrown with details.