diff --git a/core/modules/forum/lib/Drupal/forum/Form/Overview.php b/core/modules/forum/lib/Drupal/forum/Form/Overview.php index d31387c..b79bbfd 100644 --- a/core/modules/forum/lib/Drupal/forum/Form/Overview.php +++ b/core/modules/forum/lib/Drupal/forum/Form/Overview.php @@ -35,7 +35,7 @@ class Overview extends OverviewTerms { * The module handler service. */ public function __construct(EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler) { - parent::__construct($module_handler); + parent::__construct($module_handler, $entity_manager); $this->entityManager = $entity_manager; } diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php index 5a7e6fd..de0388e 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php @@ -151,10 +151,10 @@ public static function postDelete(EntityStorageControllerInterface $storage_cont // See if any of the term's children are about to be become orphans. $orphans = array(); foreach (array_keys($entities) as $tid) { - if ($children = taxonomy_term_load_children($tid)) { + if ($children = $storage_controller->loadChildren($tid)) { foreach ($children as $child) { // If the term has multiple parents, we don't delete it. - $parents = taxonomy_term_load_parents($child->id()); + $parents = $storage_controller->loadParents($child->id()); if (empty($parents)) { $orphans[] = $child->id(); } diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php index 1f1802b..b88e1fc 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php @@ -99,6 +99,12 @@ protected function buildPropertyQuery(QueryInterface $entity_query, array $value */ public function resetCache(array $ids = NULL) { drupal_static_reset('taxonomy_term_count_nodes'); + $this->parents = array(); + $this->parentsAll = array(); + $this->children = array(); + $this->treeChildren = array(); + $this->treeParents = array(); + $this->treeTerms = array(); parent::resetCache($ids); } diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermIndentationTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermIndentationTest.php index 5020cc2..44c4ee3 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermIndentationTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermIndentationTest.php @@ -72,7 +72,7 @@ function testTermIndentation() { $this->assertNoPattern('|
 
|'); // Check explicitly that term 2 has no parents. - drupal_static_reset(); + \Drupal::entityManager()->getStorageController('taxonomy_term')->resetCache(); $parents = taxonomy_term_load_parents($term2->id()); $this->assertTrue(empty($parents), 'Term 2 has no parents now'); } diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php index 5a53567..7dc9cc8 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php @@ -377,9 +377,7 @@ function testTermReorder() { // Fetch the created terms in the default alphabetical order, i.e. term1 // precedes term2 alphabetically, and term2 precedes term3. - drupal_static_reset('taxonomy_get_tree'); - drupal_static_reset('taxonomy_get_treeparent'); - drupal_static_reset('taxonomy_get_treeterms'); + \Drupal::entityManager()->getStorageController('taxonomy_term')->resetCache(); list($term1, $term2, $term3) = taxonomy_get_tree($this->vocabulary->id(), 0, NULL, TRUE); $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview'); @@ -404,9 +402,7 @@ function testTermReorder() { ); $this->drupalPostForm(NULL, $edit, t('Save')); - drupal_static_reset('taxonomy_get_tree'); - drupal_static_reset('taxonomy_get_treeparent'); - drupal_static_reset('taxonomy_get_treeterms'); + \Drupal::entityManager()->getStorageController('taxonomy_term')->resetCache(); $terms = taxonomy_get_tree($this->vocabulary->id()); $this->assertEqual($terms[0]->tid, $term2->id(), 'Term 2 was moved above term 1.'); $this->assertEqual($terms[1]->parents, array($term2->id()), 'Term 3 was made a child of term 2.'); @@ -416,9 +412,7 @@ function testTermReorder() { // Submit confirmation form. $this->drupalPostForm(NULL, array(), t('Reset to alphabetical')); - drupal_static_reset('taxonomy_get_tree'); - drupal_static_reset('taxonomy_get_treeparent'); - drupal_static_reset('taxonomy_get_treeterms'); + \Drupal::entityManager()->getStorageController('taxonomy_term')->resetCache(); $terms = taxonomy_get_tree($this->vocabulary->id(), 0, NULL, TRUE); $this->assertEqual($terms[0]->id(), $term1->id(), 'Term 1 was moved to back above term 2.'); $this->assertEqual($terms[1]->id(), $term2->id(), 'Term 2 was moved to back below term 1.');