Differential D20534 Diff 48979 src/applications/feed/query/PhabricatorFeedTransactionSearchEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/feed/query/PhabricatorFeedTransactionSearchEngine.php
Show All 15 Lines | final class PhabricatorFeedTransactionSearchEngine | ||||
} | } | ||||
protected function buildCustomSearchFields() { | protected function buildCustomSearchFields() { | ||||
return array( | return array( | ||||
id(new PhabricatorUsersSearchField()) | id(new PhabricatorUsersSearchField()) | ||||
->setLabel(pht('Authors')) | ->setLabel(pht('Authors')) | ||||
->setKey('authorPHIDs') | ->setKey('authorPHIDs') | ||||
->setAliases(array('author', 'authors')), | ->setAliases(array('author', 'authors')), | ||||
id(new PhabricatorSearchDatasourceField()) | |||||
->setLabel(pht('Object Types')) | |||||
->setKey('objectTypes') | |||||
->setAliases(array('objectType')) | |||||
->setDatasource(new PhabricatorTransactionsObjectTypeDatasource()), | |||||
id(new PhabricatorSearchDateField()) | id(new PhabricatorSearchDateField()) | ||||
->setLabel(pht('Created After')) | ->setLabel(pht('Created After')) | ||||
->setKey('createdStart'), | ->setKey('createdStart'), | ||||
id(new PhabricatorSearchDateField()) | id(new PhabricatorSearchDateField()) | ||||
->setLabel(pht('Created Before')) | ->setLabel(pht('Created Before')) | ||||
->setKey('createdEnd'), | ->setKey('createdEnd'), | ||||
); | ); | ||||
} | } | ||||
protected function buildQueryFromParameters(array $map) { | protected function buildQueryFromParameters(array $map) { | ||||
$query = $this->newQuery(); | $query = $this->newQuery(); | ||||
if ($map['authorPHIDs']) { | if ($map['authorPHIDs']) { | ||||
$query->withAuthorPHIDs($map['authorPHIDs']); | $query->withAuthorPHIDs($map['authorPHIDs']); | ||||
} | } | ||||
if ($map['objectTypes']) { | |||||
$query->withObjectTypes($map['objectTypes']); | |||||
} | |||||
$created_min = $map['createdStart']; | $created_min = $map['createdStart']; | ||||
$created_max = $map['createdEnd']; | $created_max = $map['createdEnd']; | ||||
if ($created_min && $created_max) { | if ($created_min && $created_max) { | ||||
if ($created_min > $created_max) { | if ($created_min > $created_max) { | ||||
throw new PhabricatorSearchConstraintException( | throw new PhabricatorSearchConstraintException( | ||||
pht( | pht( | ||||
'The specified "Created Before" date is earlier in time than the '. | 'The specified "Created Before" date is earlier in time than the '. | ||||
▲ Show 20 Lines • Show All 98 Lines • Show Last 20 Lines |