mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 20:10:55 +01:00
Allow Legalpad documents to be destroyed with bin/remove destroy
Summary: Ref T3116. Support permanent destruction of legal document objects. Test Plan: Ran `bin/remove destroy L1`, saw it clean up the document body, signatures, transactions and edges. Reviewers: btrahan, chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T3116 Differential Revision: https://secure.phabricator.com/D9775
This commit is contained in:
parent
c9184db94a
commit
94926698e0
2 changed files with 30 additions and 1 deletions
|
@ -3611,6 +3611,7 @@ phutil_register_library_map(array(
|
|||
1 => 'PhabricatorPolicyInterface',
|
||||
2 => 'PhabricatorSubscribableInterface',
|
||||
3 => 'PhabricatorApplicationTransactionInterface',
|
||||
4 => 'PhabricatorDestructableInterface',
|
||||
),
|
||||
'LegalpadDocumentBody' =>
|
||||
array(
|
||||
|
|
|
@ -4,7 +4,8 @@ final class LegalpadDocument extends LegalpadDAO
|
|||
implements
|
||||
PhabricatorPolicyInterface,
|
||||
PhabricatorSubscribableInterface,
|
||||
PhabricatorApplicationTransactionInterface {
|
||||
PhabricatorApplicationTransactionInterface,
|
||||
PhabricatorDestructableInterface {
|
||||
|
||||
protected $title;
|
||||
protected $contributorCount;
|
||||
|
@ -170,4 +171,31 @@ final class LegalpadDocument extends LegalpadDAO
|
|||
return new LegalpadTransaction();
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorDestructableInterface )----------------------------------- */
|
||||
|
||||
|
||||
public function destroyObjectPermanently(
|
||||
PhabricatorDestructionEngine $engine) {
|
||||
|
||||
$this->openTransaction();
|
||||
$this->delete();
|
||||
|
||||
$bodies = id(new LegalpadDocumentBody())->loadAllWhere(
|
||||
'documentPHID = %s',
|
||||
$this->getPHID());
|
||||
foreach ($bodies as $body) {
|
||||
$body->delete();
|
||||
}
|
||||
|
||||
$signatures = id(new LegalpadDocumentSignature())->loadAllWhere(
|
||||
'documentPHID = %s',
|
||||
$this->getPHID());
|
||||
foreach ($signatures as $signature) {
|
||||
$signature->delete();
|
||||
}
|
||||
|
||||
$this->saveTransaction();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue