diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php --- a/src/applications/maniphest/storage/ManiphestTask.php +++ b/src/applications/maniphest/storage/ManiphestTask.php @@ -7,7 +7,8 @@ PhabricatorTokenReceiverInterface, PhabricatorFlaggableInterface, PhrequentTrackableInterface, - PhabricatorCustomFieldInterface { + PhabricatorCustomFieldInterface, + PhabricatorDestructableInterface { const MARKUP_FIELD_DESCRIPTION = 'markup:desc'; @@ -282,4 +283,26 @@ 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(); + } + }