diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 85a7b051ff..3bf17cc131 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -4231,6 +4231,7 @@ phutil_register_library_map(array( 'PhabricatorDashboard' => array( 'PhabricatorDashboardDAO', 'PhabricatorPolicyInterface', + 'PhabricatorDestructibleInterface', ), 'PhabricatorDashboardAddPanelController' => 'PhabricatorDashboardController', 'PhabricatorDashboardApplication' => 'PhabricatorApplication', @@ -4249,6 +4250,7 @@ phutil_register_library_map(array( 'PhabricatorDashboardDAO', 'PhabricatorPolicyInterface', 'PhabricatorCustomFieldInterface', + 'PhabricatorDestructibleInterface', ), 'PhabricatorDashboardPanelArchiveController' => 'PhabricatorDashboardController', 'PhabricatorDashboardPanelCoreCustomField' => array( diff --git a/src/applications/dashboard/storage/PhabricatorDashboard.php b/src/applications/dashboard/storage/PhabricatorDashboard.php index 1d81a0b1e4..3beb71b775 100644 --- a/src/applications/dashboard/storage/PhabricatorDashboard.php +++ b/src/applications/dashboard/storage/PhabricatorDashboard.php @@ -4,7 +4,9 @@ * A collection of dashboard panels with a specific layout. */ final class PhabricatorDashboard extends PhabricatorDashboardDAO - implements PhabricatorPolicyInterface { + implements + PhabricatorPolicyInterface, + PhabricatorDestructibleInterface { protected $name; protected $viewPolicy; @@ -104,4 +106,24 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO return null; } + +/* -( PhabricatorDestructibleInterface )----------------------------------- */ + + + public function destroyObjectPermanently( + PhabricatorDestructionEngine $engine) { + + $this->openTransaction(); + $installs = id(new PhabricatorDashboardInstall())->loadAllWhere( + 'dashboardPHID = %s', + $this->getPHID()); + foreach ($installs as $install) { + $install->delete(); + } + + $this->delete(); + $this->saveTransaction(); + } + + } diff --git a/src/applications/dashboard/storage/PhabricatorDashboardPanel.php b/src/applications/dashboard/storage/PhabricatorDashboardPanel.php index 8b7467bd3e..5c32a14165 100644 --- a/src/applications/dashboard/storage/PhabricatorDashboardPanel.php +++ b/src/applications/dashboard/storage/PhabricatorDashboardPanel.php @@ -7,7 +7,8 @@ final class PhabricatorDashboardPanel extends PhabricatorDashboardDAO implements PhabricatorPolicyInterface, - PhabricatorCustomFieldInterface { + PhabricatorCustomFieldInterface, + PhabricatorDestructibleInterface { protected $name; protected $panelType; @@ -131,4 +132,16 @@ final class PhabricatorDashboardPanel return $this; } + +/* -( PhabricatorDestructibleInterface )----------------------------------- */ + + + public function destroyObjectPermanently( + PhabricatorDestructionEngine $engine) { + + $this->openTransaction(); + $this->delete(); + $this->saveTransaction(); + } + }