Slowvote - add ability to destroy a poll
Summary: Fixes T5773. Test Plan: Made a poll and voted on it. Deleted it via ./bin/remove destory V1. No errors and the poll is gone. Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T5773 Differential Revision: https://secure.phabricator.com/D10167
This commit is contained in:
@@ -6,7 +6,8 @@ final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO
|
||||
PhabricatorSubscribableInterface,
|
||||
PhabricatorFlaggableInterface,
|
||||
PhabricatorTokenReceiverInterface,
|
||||
PhabricatorProjectInterface {
|
||||
PhabricatorProjectInterface,
|
||||
PhabricatorDestructibleInterface {
|
||||
|
||||
const RESPONSES_VISIBLE = 0;
|
||||
const RESPONSES_VOTERS = 1;
|
||||
@@ -139,4 +140,26 @@ final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO
|
||||
return array($this->getAuthorPHID());
|
||||
}
|
||||
|
||||
/* -( PhabricatorDestructableInterface )----------------------------------- */
|
||||
|
||||
public function destroyObjectPermanently(
|
||||
PhabricatorDestructionEngine $engine) {
|
||||
|
||||
$this->openTransaction();
|
||||
$choices = id(new PhabricatorSlowvoteChoice())->loadAllWhere(
|
||||
'pollID = %d',
|
||||
$this->getID());
|
||||
foreach ($choices as $choice) {
|
||||
$choice->delete();
|
||||
}
|
||||
$options = id(new PhabricatorSlowvoteOption())->loadAllWhere(
|
||||
'pollID = %d',
|
||||
$this->getID());
|
||||
foreach ($options as $option) {
|
||||
$option->delete();
|
||||
}
|
||||
$this->delete();
|
||||
$this->saveTransaction();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user