3 abstract class PhabricatorSearchTokenizerField
4 extends PhabricatorSearchField
{
6 protected function getDefaultValue() {
10 protected function getValueFromRequest(AphrontRequest
$request, $key) {
11 return $this->getListFromRequest($request, $key);
14 public function getValueForQuery($value) {
15 return $this->newDatasource()
16 ->setViewer($this->getViewer())
17 ->evaluateTokens($value);
20 protected function newControl() {
21 return id(new AphrontFormTokenizerControl())
22 ->setDatasource($this->newDatasource());
26 abstract protected function newDatasource();
29 protected function getUsersFromRequest(
30 AphrontRequest
$request,
32 array $allow_types = array()) {
33 $list = $this->getListFromRequest($request, $key);
37 $allow_types = array_fuse($allow_types);
38 $user_type = PhabricatorPeopleUserPHIDType
::TYPECONST
;
39 foreach ($list as $item) {
40 $type = phid_get_type($item);
41 if ($type == $user_type) {
43 } else if (isset($allow_types[$type])) {
46 if (PhabricatorTypeaheadDatasource
::isFunctionToken($item)) {
47 // If this is a function, pass it through unchanged; we'll evaluate
57 $users = id(new PhabricatorPeopleQuery())
58 ->setViewer($this->getViewer())
59 ->withUsernames($names)
61 foreach ($users as $user) {
62 $phids[] = $user->getPHID();
64 $phids = array_unique($phids);