diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php index 0ad93dc04e..f380495b5c 100644 --- a/src/applications/maniphest/storage/ManiphestTask.php +++ b/src/applications/maniphest/storage/ManiphestTask.php @@ -7,7 +7,8 @@ final class ManiphestTask extends ManiphestDAO PhabricatorTokenReceiverInterface, PhabricatorFlaggableInterface, PhrequentTrackableInterface, - PhabricatorCustomFieldInterface { + PhabricatorCustomFieldInterface, + PhabricatorDestructableInterface { const MARKUP_FIELD_DESCRIPTION = 'markup:desc'; @@ -282,4 +283,26 @@ final class ManiphestTask extends ManiphestDAO return $this; } + +/* -( PhabricatorDestructableInterface )----------------------------------- */ + + + public function destroyObjectPermanently( + PhabricatorDestructionEngine $engine) { + + $this->openTransaction(); + + // TODO: Once this implements PhabricatorTransactionInterface, this + // will be handled automatically and can be removed. + $xactions = id(new ManiphestTransaction())->loadAllWhere( + 'objectPHID = %s', + $this->getPHID()); + foreach ($xactions as $xaction) { + $engine->destroyObject($xaction); + } + + $this->delete(); + $this->saveTransaction(); + } + }