Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / almanac / controller / AlmanacInterfaceEditController.php
blob017dad00cea2faa3dbf09231fcc1b1061e81ed10
1 <?php
3 final class AlmanacInterfaceEditController
4 extends AlmanacDeviceController {
6 public function handleRequest(AphrontRequest $request) {
7 $viewer = $this->getViewer();
9 $engine = id(new AlmanacInterfaceEditEngine())
10 ->setController($this);
12 $id = $request->getURIData('id');
13 if (!$id) {
14 $device = id(new AlmanacDeviceQuery())
15 ->setViewer($viewer)
16 ->withIDs(array($request->getInt('deviceID')))
17 ->requireCapabilities(
18 array(
19 PhabricatorPolicyCapability::CAN_VIEW,
20 PhabricatorPolicyCapability::CAN_EDIT,
22 ->executeOne();
23 if (!$device) {
24 return new Aphront404Response();
27 $engine
28 ->addContextParameter('deviceID', $device->getID())
29 ->setDevice($device);
32 return $engine->buildResponse();