Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php
12242 views
1
<?php
2
3
final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants {
4
5
const TABLE_NAME_EDGE = 'edge';
6
const TABLE_NAME_EDGEDATA = 'edgedata';
7
8
public static function establishConnection($phid_type, $conn_type) {
9
$map = PhabricatorPHIDType::getAllTypes();
10
if (isset($map[$phid_type])) {
11
$type = $map[$phid_type];
12
$object = $type->newObject();
13
if ($object) {
14
return $object->establishConnection($conn_type);
15
}
16
}
17
18
static $class_map = array(
19
PhabricatorPHIDConstants::PHID_TYPE_TOBJ => 'HarbormasterObject',
20
);
21
22
$class = idx($class_map, $phid_type);
23
24
if (!$class) {
25
throw new Exception(
26
pht(
27
"Edges are not available for objects of type '%s'!",
28
$phid_type));
29
}
30
31
return newv($class, array())->establishConnection($conn_type);
32
}
33
34
}
35
36