diff --git a/src/applications/phriction/storage/PhrictionDocument.php b/src/applications/phriction/storage/PhrictionDocument.php index 8c5b5d58bc..07a3d5ec0f 100644 --- a/src/applications/phriction/storage/PhrictionDocument.php +++ b/src/applications/phriction/storage/PhrictionDocument.php @@ -5,7 +5,8 @@ final class PhrictionDocument extends PhrictionDAO PhabricatorPolicyInterface, PhabricatorSubscribableInterface, PhabricatorFlaggableInterface, - PhabricatorTokenReceiverInterface { + PhabricatorTokenReceiverInterface, + PhabricatorDestructableInterface { protected $slug; protected $depth; @@ -180,4 +181,26 @@ final class PhrictionDocument extends PhrictionDAO public function getUsersToNotifyOfTokenGiven() { return PhabricatorSubscribersQuery::loadSubscribersForPHID($this->phid); } + + +/* -( PhabricatorDestructableInterface )----------------------------------- */ + + + public function destroyObjectPermanently( + PhabricatorDestructionEngine $engine) { + + $this->openTransaction(); + + $this->delete(); + + $contents = id(new PhrictionContent())->loadAllWhere( + 'documentID = %d', + $this->getID()); + foreach ($contents as $content) { + $content->delete(); + } + + $this->saveTransaction(); + } + }