Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / almanac / controller / AlmanacPropertyController.php
blobdeb2709dddec2b1ce02c36f32e81b9bec136cc44
1 <?php
3 abstract class AlmanacPropertyController extends AlmanacController {
5 private $propertyObject;
7 public function getPropertyObject() {
8 return $this->propertyObject;
11 protected function loadPropertyObject() {
12 $viewer = $this->getViewer();
13 $request = $this->getRequest();
14 $object_phid = $request->getStr('objectPHID');
17 switch (phid_get_type($object_phid)) {
18 case AlmanacBindingPHIDType::TYPECONST:
19 $query = new AlmanacBindingQuery();
20 break;
21 case AlmanacDevicePHIDType::TYPECONST:
22 $query = new AlmanacDeviceQuery();
23 break;
24 case AlmanacServicePHIDType::TYPECONST:
25 $query = new AlmanacServiceQuery();
26 break;
27 default:
28 return new Aphront404Response();
31 $object = $query
32 ->setViewer($viewer)
33 ->withPHIDs(array($object_phid))
34 ->requireCapabilities(
35 array(
36 PhabricatorPolicyCapability::CAN_VIEW,
37 PhabricatorPolicyCapability::CAN_EDIT,
39 ->needProperties(true)
40 ->executeOne();
42 if (!$object) {
43 return new Aphront404Response();
46 if (!($object instanceof AlmanacPropertyInterface)) {
47 return new Aphront404Response();
50 $this->propertyObject = $object;
52 return null;