setKey('spacePHIDs') ->setConduitKey('spaces') ->setAliases(array('space', 'spaces')) ->setLabel(pht('Spaces')) ->setDescription( pht('Search for objects in certain spaces.')); } return $fields; } public function applyConstraintsToQuery( $object, $query, PhabricatorSavedQuery $saved, array $map) { if (!empty($map['spacePHIDs'])) { $query->withSpacePHIDs($map['spacePHIDs']); } else { // If the user doesn't search for objects in specific spaces, we // default to "all active spaces you have permission to view". $query->withSpaceIsArchived(false); } } public function getFieldSpecificationsForConduit($object) { return array( 'spacePHID' => array( 'type' => 'phid?', 'description' => pht( 'PHID of the policy space this object is part of.'), ), ); } public function getFieldValuesForConduit($object) { return array( 'spacePHID' => $object->getSpacePHID(), ); } }