Skip to content
Snippets Groups Projects

Issue #3274216: Remove Cloud Project when K8s Cloud Service Provider is deleted

Merged Issue #3274216: Remove Cloud Project when K8s Cloud Service Provider is deleted
All threads resolved!
Merged Masami Suzuki requested to merge issue/cloud-3274216:3274216-remove-cloud-project into 5.x
All threads resolved!
+ 11
0
@@ -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());
Loading