1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +01:00

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:
epriestley 2014-08-25 08:41:03 -07:00
parent 3275d80cf9
commit 17376927e5
2 changed files with 34 additions and 2 deletions

View file

@ -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();
}
}

View file

@ -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();
}
}