Problem/Motivation

ForumManagerInterface::getParents() was deprecated in #2353013: Remove taxonomy_term_load_parents_all from taxonomy/taxonomy.module, but it's usage was not removed.

Proposed resolution

  • Remove usages of ForumManager::getParents() from core.
  • Trigger an E_USER_DEPRECATED error from ForumManager::getParents()
  • add a legacy test to ensure the error is triggered, and the the deprecated method
  • Create and publish a CR identifying the already deprecated method.
  • Update the @deprecation tag wording to current standards.

Remaining tasks

Review it
Commit it

User interface changes

none

API changes

none

Comments

larowlan’s picture

Assigned: Unassigned » larowlan
larowlan’s picture

Status: Postponed » Needs review
StatusFileSize
new4.76 KB

Done

larowlan’s picture

Assigned: larowlan » Unassigned
andypost’s picture

Version: 9.x-dev » 8.0.x-dev
Issue tags: +@deprecated

I don't think it's disruptive, and already marked as deprecated

bertramakers’s picture

Note that this method has only been marked as deprecated in #2353013-10: Remove taxonomy_term_load_parents_all from taxonomy/taxonomy.module, so not that long ago. But I agree that the change is not that disruptive.

Doesn't really make much sense to have a new method in D8 if it's already deprecated anyway.

mile23’s picture

Status: Needs review » Needs work

I'm not so sure we should remove convenience methods like this, but reviewing anyway.

The patch in #2 still applies, but running unit tests leads to this error:

[29-Mar-2015 16:01:33 UTC] PHP Fatal error:  Call to undefined method Mock_EntityStorageInterface_1968d3ad::loadAllParents() in /Users/paulmitchum/projects/drupal8/core/modules/forum/src/Breadcrumb/ForumListingBreadcrumbBuilder.php on line 36
mile23’s picture

+++ b/core/modules/forum/src/ForumManagerInterface.php
@@ -57,20 +57,6 @@ public function getIndex();
-   * @deprecated Scheduled to be removed in 9.0.x, see
-   *   https://www.drupal.org/node/2371593.

At this point in the release cycle, this should be marked as to be removed before 9.0.0.

mile23’s picture

Issue tags: +Needs reroll

Needs a reroll.

$ git apply forum-parents-wrapper-2371593.2.patch 
error: patch failed: core/modules/forum/src/Breadcrumb/ForumListingBreadcrumbBuilder.php:30
error: core/modules/forum/src/Breadcrumb/ForumListingBreadcrumbBuilder.php: patch does not apply
error: patch failed: core/modules/forum/src/Breadcrumb/ForumNodeBreadcrumbBuilder.php:30
error: core/modules/forum/src/Breadcrumb/ForumNodeBreadcrumbBuilder.php: patch does not apply
madhavvyas’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new4.72 KB

Patch re-rolled comment 2

Status: Needs review » Needs work

The last submitted patch, 9: forum-parents-wrapper-2371593-9.patch, failed testing.

mile23’s picture

Title: Remove ForumManagerInterface::getParents(), use TermStorage::loadAllParents() instead » Mark ForumManagerInterface::getParents() as @deprecated in 8.1.x for removal in 9.0.x, use TermStorage::loadAllParents() instead, remove usages.
Version: 8.0.x-dev » 8.1.x-dev
Issue summary: View changes

Rescoping a little bit here so we're properly marking the deprecation.

The patch in #9 applies. Here's some review:

  1. +++ b/core/modules/forum/src/Breadcrumb/ForumListingBreadcrumbBuilder.php
    @@ -35,7 +35,10 @@ public function build(RouteMatchInterface $route_match) {
    +    /* @var \Drupal\taxonomy\TermStorageInterface $taxonomy_storage */
    +    $taxonomy_storage = $this->entityManager
    +      ->getStorage('taxonomy_vocabulary');
    +    $parents = $taxonomy_storage->loadAllParents($term_id);
    
    +++ b/core/modules/forum/src/Breadcrumb/ForumNodeBreadcrumbBuilder.php
    @@ -31,7 +31,10 @@ public function build(RouteMatchInterface $route_match) {
    +    /* @var \Drupal\taxonomy\TermStorageInterface $taxonomy_storage */
    +    $taxonomy_storage = $this->entityManager
    +      ->getStorage('taxonomy_vocabulary');
    +    $parents = $taxonomy_storage->loadAllParents($route_match->getParameter('node')->forum_tid);
    

    Entity manager is deprecated, so just get the entity storage manager service for the entity type.

  2. +++ b/core/modules/forum/src/ForumManager.php
    @@ -462,13 +462,6 @@ public function resetCache() {
    -  public function getParents($tid) {
    
    +++ b/core/modules/forum/src/ForumManagerInterface.php
    @@ -57,20 +57,6 @@ public function getIndex();
    -   * Fetches the parent forums for a given forum.
    -   *
    -   * @param int $tid
    -   *   Term ID.
    -   *
    -   * @return array
    -   *   Array of parent terms.
    -   *
    -   * @deprecated Scheduled to be removed in 9.0.x, see
    -   *   https://www.drupal.org/node/2371593.
    -   */
    -  public function getParents($tid);
    

    We can't delete the method yet, since it's deprecated for removal in d9.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

ashishdalvi’s picture

Issue tags: +DrupalMumbaiCodeSprint

Marking issue for Drupal Mumbai Code Sprint

andypost’s picture

btw I think better to move it out of storage handler back to forum manager and convert to entity query, this way it will be independent from storage

maybe it needs follow-up? @larowlan any thoughts?

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mikelutz’s picture

imalabya’s picture

Issue tags: +Needs reroll

The patch doesn't apply anymore. Added a Reroll tag.

mikelutz’s picture

Rewriting from scratch to modern standards.

mikelutz’s picture

Title: Mark ForumManagerInterface::getParents() as @deprecated in 8.1.x for removal in 9.0.x, use TermStorage::loadAllParents() instead, remove usages. » Properly deprecate ForumManagerInterface::getParents().
Issue summary: View changes

Updating Issue title and Summary.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. The test isn't very explicit as it just compares the two calls but I think that's enough for this simple deprecation.

  • catch committed 04051f2 on 8.8.x
    Issue #2371593 by mikelutz, larowlan, madhavvyas, Mile23, andypost,...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 04051f2 and pushed to 8.8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

quietone’s picture

Publish change record