Allow Ponder questions and answers to be destroyed with bin/remove
Summary: Ref T5847. Test Plan: Used `bin/remove destroy` to destroy a question. Saw the question and its answers get wiped out. Reviewers: btrahan, shadowhand Reviewed By: shadowhand Subscribers: shadowhand, epriestley Maniphest Tasks: T5847 Differential Revision: https://secure.phabricator.com/D10345
This commit is contained in:
@@ -7,7 +7,8 @@ final class PonderAnswer extends PonderDAO
|
||||
PhabricatorPolicyInterface,
|
||||
PhabricatorFlaggableInterface,
|
||||
PhabricatorSubscribableInterface,
|
||||
PhabricatorTokenReceiverInterface {
|
||||
PhabricatorTokenReceiverInterface,
|
||||
PhabricatorDestructibleInterface {
|
||||
|
||||
const MARKUP_FIELD_CONTENT = 'markup:content';
|
||||
|
||||
@@ -195,4 +196,16 @@ final class PonderAnswer extends PonderDAO
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorDestructibleInterface )----------------------------------- */
|
||||
|
||||
|
||||
public function destroyObjectPermanently(
|
||||
PhabricatorDestructionEngine $engine) {
|
||||
|
||||
$this->openTransaction();
|
||||
$this->delete();
|
||||
$this->saveTransaction();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@ final class PonderQuestion extends PonderDAO
|
||||
PhabricatorFlaggableInterface,
|
||||
PhabricatorPolicyInterface,
|
||||
PhabricatorTokenReceiverInterface,
|
||||
PhabricatorProjectInterface {
|
||||
PhabricatorProjectInterface,
|
||||
PhabricatorDestructibleInterface {
|
||||
|
||||
const MARKUP_FIELD_CONTENT = 'markup:content';
|
||||
|
||||
@@ -247,4 +248,22 @@ final class PonderQuestion extends PonderDAO
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorDestructibleInterface )----------------------------------- */
|
||||
|
||||
public function destroyObjectPermanently(
|
||||
PhabricatorDestructionEngine $engine) {
|
||||
|
||||
$this->openTransaction();
|
||||
$answers = id(new PonderAnswer())->loadAllWhere(
|
||||
'questionID = %d',
|
||||
$this->getID());
|
||||
foreach ($answers as $answer) {
|
||||
$engine->destroyObject($answer);
|
||||
}
|
||||
|
||||
$this->delete();
|
||||
$this->saveTransaction();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user