Skip to content

Commit

Permalink
Merge pull request #805 from City-of-Helsinki/UHF-9446
Browse files Browse the repository at this point in the history
UHF-9446: Add update hook that removes district listing paragraphs from the database
  • Loading branch information
teroelonen authored Feb 27, 2024
2 parents d448d90 + e62a8e7 commit 4e74230
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,19 @@ declare(strict_types=1);
function helfi_kymp_content_update_9001(): void {
_helfi_kymp_content_create_district_nodes_from_taxonomy_terms();
}

/**
* UHF-9446: Remove all district listing paragraphs.
*/
function helfi_kymp_content_update_9002(): void {
$storage = \Drupal::entityTypeManager()
->getStorage('paragraph');
$entityIds = $storage->getQuery()
->condition('type', 'district_listing')
->accessCheck(FALSE)
->execute();

foreach ($entityIds as $id) {
$storage->load($id)->delete();
}
}

0 comments on commit 4e74230

Please sign in to comment.