diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php index ecdd28f31c..e7c56f2e04 100644 --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -5,7 +5,8 @@ final class PhabricatorProject extends PhabricatorProjectDAO PhabricatorFlaggableInterface, PhabricatorPolicyInterface, PhabricatorSubscribableInterface, - PhabricatorCustomFieldInterface { + PhabricatorCustomFieldInterface, + PhabricatorDestructableInterface { protected $name; protected $status = PhabricatorProjectStatus::STATUS_ACTIVE; @@ -247,4 +248,27 @@ final class PhabricatorProject extends PhabricatorProjectDAO } +/* -( PhabricatorDestructableInterface )----------------------------------- */ + + public function destroyObjectPermanently( + PhabricatorDestructionEngine $engine) { + + $this->openTransaction(); + $this->delete(); + + $columns = id(new PhabricatorProjectColumn()) + ->loadAllWhere('projectPHID = %s', $this->getPHID()); + foreach ($columns as $column) { + $engine->destroyObject($column); + } + + $slugs = id(new PhabricatorProjectSlug()) + ->loadAllWhere('projectPHID = %s', $this->getPHID()); + foreach ($slugs as $slug) { + $slug->delete(); + } + + $this->saveTransaction(); + } + } diff --git a/src/applications/project/storage/PhabricatorProjectColumn.php b/src/applications/project/storage/PhabricatorProjectColumn.php index e79443c22a..439e1ea13b 100644 --- a/src/applications/project/storage/PhabricatorProjectColumn.php +++ b/src/applications/project/storage/PhabricatorProjectColumn.php @@ -2,7 +2,8 @@ final class PhabricatorProjectColumn extends PhabricatorProjectDAO - implements PhabricatorPolicyInterface { + implements PhabricatorPolicyInterface, + PhabricatorDestructableInterface { const STATUS_ACTIVE = 0; const STATUS_DELETED = 1; @@ -87,4 +88,15 @@ final class PhabricatorProjectColumn return pht('Users must be able to see a project to see its board.'); } + +/* -( PhabricatorDestructableInterface )----------------------------------- */ + + public function destroyObjectPermanently( + PhabricatorDestructionEngine $engine) { + + $this->openTransaction(); + $this->delete(); + $this->saveTransaction(); + } + }