Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14322176
D16997.id40900.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D16997.id40900.diff
View Options
diff --git a/src/applications/phid/query/PhabricatorObjectQuery.php b/src/applications/phid/query/PhabricatorObjectQuery.php
--- a/src/applications/phid/query/PhabricatorObjectQuery.php
+++ b/src/applications/phid/query/PhabricatorObjectQuery.php
@@ -29,11 +29,6 @@
$this->namedResults = array();
}
- $types = PhabricatorPHIDType::getAllTypes();
- if ($this->types) {
- $types = array_select_keys($types, $this->types);
- }
-
$names = array_unique($this->names);
$phids = $this->phids;
@@ -51,15 +46,30 @@
}
}
- $phids = array_unique($phids);
-
if ($names) {
+ $types = PhabricatorPHIDType::getAllTypes();
+ if ($this->types) {
+ $types = array_select_keys($types, $this->types);
+ }
$name_results = $this->loadObjectsByName($types, $names);
} else {
$name_results = array();
}
if ($phids) {
+ $phids = array_unique($phids);
+
+ $phid_types = array();
+ foreach ($phids as $phid) {
+ $phid_type = phid_get_type($phid);
+ $phid_types[$phid_type] = $phid_type;
+ }
+
+ $types = PhabricatorPHIDType::getTypes($phid_types);
+ if ($this->types) {
+ $types = array_select_keys($types, $this->types);
+ }
+
$phid_results = $this->loadObjectsByPHID($types, $phids);
} else {
$phid_results = array();
diff --git a/src/applications/phid/type/PhabricatorPHIDType.php b/src/applications/phid/type/PhabricatorPHIDType.php
--- a/src/applications/phid/type/PhabricatorPHIDType.php
+++ b/src/applications/phid/type/PhabricatorPHIDType.php
@@ -144,10 +144,21 @@
* @return dict<string, PhabricatorPHIDType> Map of type constants to types.
*/
final public static function getAllTypes() {
+ return self::newClassMapQuery()
+ ->execute();
+ }
+
+ final public static function getTypes(array $types) {
+ return id(new PhabricatorCachedClassMapQuery())
+ ->setClassMapQuery(self::newClassMapQuery())
+ ->setMapKeyMethod('getTypeConstant')
+ ->loadClasses($types);
+ }
+
+ private static function newClassMapQuery() {
return id(new PhutilClassMapQuery())
->setAncestorClass(__CLASS__)
- ->setUniqueMethod('getTypeConstant')
- ->execute();
+ ->setUniqueMethod('getTypeConstant');
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 12:33 PM (2 h, 38 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6907315
Default Alt Text
D16997.id40900.diff (2 KB)
Attached To
Mode
D16997: Use PhabricatorCachedClassMapQuery when querying object PHID types
Attached
Detach File
Event Timeline
Log In to Comment