Skip to content

Commit 755ae69

Browse files
committed
Added update hoook
1 parent db7f735 commit 755ae69

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

web/modules/custom/hoeringsportal_data/hoeringsportal_data.install

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,28 @@ function hoeringsportal_data_update_10003() {
166166

167167
_hoeringsportal_data_add_columns_to_schema($columns_to_add, $field_id);
168168
}
169+
170+
/**
171+
* Delete old timeline nodes and terms.
172+
*/
173+
function hoeringsportal_data_update_10004() {
174+
$entity_type_manager = \Drupal::entityTypeManager();
175+
176+
$nodeStorage = $entity_type_manager->getStorage('node');
177+
$nids = $nodeStorage->getQuery()
178+
->accessCheck(FALSE)
179+
->condition('type', 'project')
180+
->execute();
181+
182+
$nodes = $nodeStorage->loadMultiple($nids);
183+
$nodeStorage->delete($nodes);
184+
185+
$termStorage = $entity_type_manager->getStorage('taxonomy_term');
186+
$tids = $termStorage->getQuery()
187+
->accessCheck(FALSE)
188+
->condition('vid', 'timeline_item_types')
189+
->execute();
190+
191+
$terms = $termStorage->loadMultiple($tids);
192+
$termStorage->delete($terms);
193+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php

0 commit comments

Comments
 (0)