[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorHandleQuery 4 extends PhabricatorCursorPagedPolicyAwareQuery { 5 6 private $phids = array(); 7 8 public function withPHIDs(array $phids) { 9 $this->phids = $phids; 10 return $this; 11 } 12 13 public function loadPage() { 14 $types = PhabricatorPHIDType::getAllTypes(); 15 16 $phids = array_unique($this->phids); 17 if (!$phids) { 18 return array(); 19 } 20 21 $object_query = id(new PhabricatorObjectQuery()) 22 ->withPHIDs($phids) 23 ->setViewer($this->getViewer()); 24 25 $objects = $object_query->execute(); 26 $filtered = $object_query->getPolicyFilteredPHIDs(); 27 28 $groups = array(); 29 foreach ($phids as $phid) { 30 $type = phid_get_type($phid); 31 $groups[$type][] = $phid; 32 } 33 34 $results = array(); 35 foreach ($groups as $type => $phid_group) { 36 $handles = array(); 37 foreach ($phid_group as $key => $phid) { 38 if (isset($handles[$phid])) { 39 unset($phid_group[$key]); 40 // The input had a duplicate PHID; just skip it. 41 continue; 42 } 43 $handles[$phid] = id(new PhabricatorObjectHandle()) 44 ->setType($type) 45 ->setPHID($phid); 46 if (isset($objects[$phid])) { 47 $handles[$phid]->setComplete(true); 48 } else if (isset($filtered[$phid])) { 49 $handles[$phid]->setPolicyFiltered(true); 50 } 51 } 52 53 if (isset($types[$type])) { 54 $type_objects = array_select_keys($objects, $phid_group); 55 if ($type_objects) { 56 $have_object_phids = array_keys($type_objects); 57 $types[$type]->loadHandles( 58 $this, 59 array_select_keys($handles, $have_object_phids), 60 $type_objects); 61 } 62 } 63 64 $results += $handles; 65 } 66 67 return $results; 68 } 69 70 public function getQueryApplicationClass() { 71 return null; 72 } 73 74 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |