Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15413712
D13572.id32798.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
934 B
Referenced Files
None
Subscribers
None
D13572.id32798.diff
View Options
diff --git a/src/symbols/PhutilClassMapQuery.php b/src/symbols/PhutilClassMapQuery.php
--- a/src/symbols/PhutilClassMapQuery.php
+++ b/src/symbols/PhutilClassMapQuery.php
@@ -41,6 +41,7 @@
private $ancestorClass;
private $expandMethod;
+ private $filterNull;
private $uniqueMethod;
private $sortMethod;
@@ -79,8 +80,9 @@
* @return this
* @task config
*/
- public function setUniqueMethod($unique_method) {
+ public function setUniqueMethod($unique_method, $filter_null = false) {
$this->uniqueMethod = $unique_method;
+ $this->filterNull = $filter_null;
return $this;
}
@@ -224,6 +226,11 @@
$map = array();
foreach ($list as $object) {
$key = call_user_func(array($object, $unique));
+
+ if ($key === null && $this->filterNull) {
+ continue;
+ }
+
if (empty($map[$key])) {
$map[$key] = $object;
continue;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 20, 8:47 PM (1 d, 1 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7712799
Default Alt Text
D13572.id32798.diff (934 B)
Attached To
Mode
D13572: Allow PhutilClassMapQuery to filter null
Attached
Detach File
Event Timeline
Log In to Comment