Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / search / field / PhabricatorSearchDateControlField.php
blob9ce5c0227dfa1b95483e4705fef3c3d65d076c0d
1 <?php
3 final class PhabricatorSearchDateControlField
4 extends PhabricatorSearchField {
6 protected function getValueExistsInRequest(AphrontRequest $request, $key) {
7 // The control doesn't actually submit a value with the same name as the
8 // key, so look for the "_d" value instead, which has the date part of the
9 // control value.
10 return $request->getExists($key.'_d');
13 protected function getValueFromRequest(AphrontRequest $request, $key) {
14 $value = AphrontFormDateControlValue::newFromRequest($request, $key);
15 $value->setOptional(true);
16 return $value->getDictionary();
19 protected function newControl() {
20 return id(new AphrontFormDateControl())
21 ->setAllowNull(true);
24 protected function didReadValueFromSavedQuery($value) {
25 if (!$value) {
26 return null;
29 if ($value instanceof AphrontFormDateControlValue && $value->getEpoch()) {
30 return $value->setOptional(true);
33 $value = AphrontFormDateControlValue::newFromWild(
34 $this->getViewer(),
35 $value);
36 return $value->setOptional(true);