Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / maniphest / relationship / ManiphestTaskMergeInRelationship.php
blobc8442c428f021c1c91302f20e84efdd61d4dd606
1 <?php
3 final class ManiphestTaskMergeInRelationship
4 extends ManiphestTaskRelationship {
6 const RELATIONSHIPKEY = 'task.merge-in';
8 public function getEdgeConstant() {
9 return ManiphestTaskHasDuplicateTaskEdgeType::EDGECONST;
12 protected function getActionName() {
13 return pht('Merge Duplicates In');
16 protected function getActionIcon() {
17 return 'fa-compress';
20 public function canRelateObjects($src, $dst) {
21 return ($dst instanceof ManiphestTask);
24 public function shouldAppearInActionMenu() {
25 return false;
28 public function getDialogTitleText() {
29 return pht('Merge Duplicates Into This Task');
32 public function getDialogHeaderText() {
33 return pht('Tasks to Close and Merge');
36 public function getDialogButtonText() {
37 return pht('Close and Merge Selected Tasks');
40 protected function newRelationshipSource() {
41 return id(new ManiphestTaskRelationshipSource())
42 ->setSelectedFilter('open');
45 public function getRequiredRelationshipCapabilities() {
46 return array(
47 PhabricatorPolicyCapability::CAN_VIEW,
48 PhabricatorPolicyCapability::CAN_EDIT,
52 public function canUndoRelationship() {
53 return false;
56 public function willUpdateRelationships($object, array $add, array $rem) {
57 return $this->newMergeFromTransactions($add);
60 public function didUpdateRelationships($object, array $add, array $rem) {
61 $viewer = $this->getViewer();
62 $content_source = $this->getContentSource();
64 foreach ($add as $task) {
65 $xactions = $this->newMergeIntoTransactions($object);
67 $task->getApplicationTransactionEditor()
68 ->setActor($viewer)
69 ->setContentSource($content_source)
70 ->setContinueOnMissingFields(true)
71 ->setContinueOnNoEffect(true)
72 ->applyTransactions($task, $xactions);