@@ -24,75 +24,10 @@ public static function loadOneHandle($phid, PhabricatorUser $viewer) {
24
24
public function loadObjects () {
25
25
$ phids = array_fuse ($ this ->phids );
26
26
27
- $ objects = id (new PhabricatorObjectQuery ())
27
+ return id (new PhabricatorObjectQuery ())
28
28
->setViewer ($ this ->viewer )
29
29
->withPHIDs ($ phids )
30
30
->execute ();
31
-
32
- // For objects which don't support PhabricatorPHIDType yet, load them the
33
- // old way.
34
- $ phids = array_diff_key ($ phids , array_keys ($ objects ));
35
- $ types = phid_group_by_type ($ phids );
36
- foreach ($ types as $ type => $ phids ) {
37
- $ objects += $ this ->loadObjectsOfType ($ type , $ phids );
38
- }
39
-
40
- return $ objects ;
41
- }
42
-
43
- private function loadObjectsOfType ($ type , array $ phids ) {
44
- if (!$ this ->viewer ) {
45
- throw new Exception (
46
- "You must provide a viewer to load handles or objects. " );
47
- }
48
-
49
- switch ($ type ) {
50
-
51
- case PhabricatorPHIDConstants::PHID_TYPE_XACT :
52
- $ subtypes = array ();
53
- foreach ($ phids as $ phid ) {
54
- $ subtypes [phid_get_subtype ($ phid )][] = $ phid ;
55
- }
56
- $ xactions = array ();
57
- foreach ($ subtypes as $ subtype => $ subtype_phids ) {
58
- // TODO: Do this magically.
59
- // TODO: ^^^ Really do that ^^^
60
- switch ($ subtype ) {
61
- case PonderPHIDTypeQuestion::TYPECONST :
62
- $ results = id (new PonderQuestionTransactionQuery ())
63
- ->setViewer ($ this ->viewer )
64
- ->withPHIDs ($ subtype_phids )
65
- ->execute ();
66
- $ xactions += mpull ($ results , null , 'getPHID ' );
67
- break ;
68
- case PonderPHIDTypeAnswer::TYPECONST :
69
- $ results = id (new PonderAnswerTransactionQuery ())
70
- ->setViewer ($ this ->viewer )
71
- ->withPHIDs ($ subtype_phids )
72
- ->execute ();
73
- $ xactions += mpull ($ results , null , 'getPHID ' );
74
- break ;
75
- case PholioPHIDTypeMock::TYPECONST :
76
- $ results = id (new PholioTransactionQuery ())
77
- ->setViewer ($ this ->viewer )
78
- ->withPHIDs ($ subtype_phids )
79
- ->execute ();
80
- $ xactions += mpull ($ results , null , 'getPHID ' );
81
- break ;
82
- case PhabricatorMacroPHIDTypeMacro::TYPECONST :
83
- $ results = id (new PhabricatorMacroTransactionQuery ())
84
- ->setViewer ($ this ->viewer )
85
- ->withPHIDs ($ subtype_phids )
86
- ->execute ();
87
- $ xactions += mpull ($ results , null , 'getPHID ' );
88
- break ;
89
- }
90
- }
91
- return mpull ($ xactions , null , 'getPHID ' );
92
-
93
- }
94
-
95
- return array ();
96
31
}
97
32
98
33
public function loadHandles () {
@@ -111,15 +46,11 @@ public function loadHandles() {
111
46
}
112
47
}
113
48
114
- $ all_objects = $ this ->loadObjects ();
115
49
$ types = phid_group_by_type ($ phid_map );
116
50
117
51
$ handles = array ();
118
-
119
52
foreach ($ types as $ type => $ phids ) {
120
- $ objects = array_select_keys ($ all_objects , $ phids );
121
53
switch ($ type ) {
122
-
123
54
case PhabricatorPHIDConstants::PHID_TYPE_MAGIC :
124
55
// Black magic!
125
56
foreach ($ phids as $ phid ) {
@@ -144,18 +75,6 @@ public function loadHandles() {
144
75
$ handles [$ phid ] = $ handle ;
145
76
}
146
77
break ;
147
-
148
- default :
149
- foreach ($ phids as $ phid ) {
150
- $ handle = new PhabricatorObjectHandle ();
151
- $ handle ->setType ($ type );
152
- $ handle ->setPHID ($ phid );
153
- $ handle ->setName ('Unknown Object ' );
154
- $ handle ->setFullName ('An Unknown Object ' );
155
- $ handles [$ phid ] = $ handle ;
156
- }
157
- break ;
158
-
159
78
}
160
79
}
161
80
0 commit comments