Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15426633
D14773.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D14773.id.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2849,6 +2849,7 @@
'PhabricatorProjectsEditEngineExtension' => 'applications/project/engineextension/PhabricatorProjectsEditEngineExtension.php',
'PhabricatorProjectsEditField' => 'applications/transactions/editfield/PhabricatorProjectsEditField.php',
'PhabricatorProjectsPolicyRule' => 'applications/project/policyrule/PhabricatorProjectsPolicyRule.php',
+ 'PhabricatorProjectsSearchEngineAttachment' => 'applications/project/engineextension/PhabricatorProjectsSearchEngineAttachment.php',
'PhabricatorProjectsSearchEngineExtension' => 'applications/project/engineextension/PhabricatorProjectsSearchEngineExtension.php',
'PhabricatorProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorProtocolAdapter.php',
'PhabricatorPygmentSetupCheck' => 'applications/config/check/PhabricatorPygmentSetupCheck.php',
@@ -7128,6 +7129,7 @@
'PhabricatorProjectsEditEngineExtension' => 'PhabricatorEditEngineExtension',
'PhabricatorProjectsEditField' => 'PhabricatorTokenizerEditField',
'PhabricatorProjectsPolicyRule' => 'PhabricatorPolicyRule',
+ 'PhabricatorProjectsSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment',
'PhabricatorProjectsSearchEngineExtension' => 'PhabricatorSearchEngineExtension',
'PhabricatorProtocolAdapter' => 'Phobject',
'PhabricatorPygmentSetupCheck' => 'PhabricatorSetupCheck',
diff --git a/src/applications/project/engineextension/PhabricatorProjectsSearchEngineAttachment.php b/src/applications/project/engineextension/PhabricatorProjectsSearchEngineAttachment.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/engineextension/PhabricatorProjectsSearchEngineAttachment.php
@@ -0,0 +1,43 @@
+<?php
+
+final class PhabricatorProjectsSearchEngineAttachment
+ extends PhabricatorSearchEngineAttachment {
+
+ public function getAttachmentName() {
+ return pht('Projects');
+ }
+
+ public function getAttachmentDescription() {
+ return pht('Get information about projects.');
+ }
+
+ public function loadAttachmentData(array $objects, $spec) {
+ $object_phids = mpull($objects, 'getPHID');
+
+ $projects_query = id(new PhabricatorEdgeQuery())
+ ->withSourcePHIDs($object_phids)
+ ->withEdgeTypes(
+ array(
+ PhabricatorProjectObjectHasProjectEdgeType::EDGECONST,
+ ));
+ $projects_query->execute();
+
+ return array(
+ 'projects.query' => $projects_query,
+ );
+ }
+
+ public function getAttachmentForObject($object, $data, $spec) {
+ $projects_query = $data['projects.query'];
+ $object_phid = $object->getPHID();
+
+ $project_phids = $projects_query->getDestinationPHIDs(
+ array($object_phid),
+ array(PhabricatorProjectObjectHasProjectEdgeType::EDGECONST));
+
+ return array(
+ 'projectPHIDs' => array_values($project_phids),
+ );
+ }
+
+}
diff --git a/src/applications/project/engineextension/PhabricatorProjectsSearchEngineExtension.php b/src/applications/project/engineextension/PhabricatorProjectsSearchEngineExtension.php
--- a/src/applications/project/engineextension/PhabricatorProjectsSearchEngineExtension.php
+++ b/src/applications/project/engineextension/PhabricatorProjectsSearchEngineExtension.php
@@ -49,5 +49,12 @@
return $fields;
}
+ public function getSearchAttachments() {
+ return array(
+ id(new PhabricatorProjectsSearchEngineAttachment())
+ ->setAttachmentKey('projects'),
+ );
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 24, 10:07 AM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7388983
Default Alt Text
D14773.id.diff (3 KB)
Attached To
Mode
D14773: Add a "projects" Search attachment for Conduit APIs
Attached
Detach File
Event Timeline
Log In to Comment