Skip to content
Snippets Groups Projects
Commit 54dfefef authored by Masami  Suzuki's avatar Masami Suzuki Committed by Yas Naoi
Browse files

Issue #3274216 by Masami, yas: Remove Cloud Project when K8s Cloud Service Provider is deleted

parent 4e71aa45
Branches
Tags
4 merge requests!1759Issue #3356778: Release 5.1.1,!1679Issue #3349074: Fix the OpenStack Project create and edit form in SPA that "Member" cannot be saved due to a validation error,!1607Issue #3343582: Add the function to preview OpenStack stack in the SPA,!1032Issue #3284576: Release 5.0.0-alpha2
......@@ -478,6 +478,17 @@ function cloud_mail($key, array &$message, array $params): void {
* Implements hook_cloud_config_predelete().
*/
function cloud_cloud_config_predelete(CloudConfig $cloud_config): void {
// Delete all cloud project entities.
$storage = \Drupal::entityTypeManager()->getStorage('cloud_project');
$entities = $storage->loadByProperties([
'cloud_context' => $cloud_config->getCloudContext(),
'type' => $cloud_config->bundle(),
]);
if (!empty($entities)) {
$storage->delete($entities);
}
// Delete cached operation data, if exists.
$cache_service = \Drupal::service('cloud.cache');
$cache_service->clearOperationAccessCache($cloud_config->getCloudContext());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment