Skip to content
Snippets Groups Projects
Commit b190da0d 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 2060ed40
Branches
Tags
3 merge requests!1316Issue #3310263: Release 4.5.0,!1260Issue #3307397: Release 4.4.0,!837Issue #3274216: Remove Cloud Project when K8s Cloud Service Provider is deleted
......@@ -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