This is a simple wrapper that unusable

Drop taxonomy_term_load_multiple() and replace all usage with entity_load_multiple()

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xxAlHixx’s picture

Assigned: Unassigned » xxAlHixx

WDG (Ukraine,Kharkov) want to implement this on CodeSprintUA.

xxAlHixx’s picture

Status: Active » Needs review
FileSize
7.71 KB
andypost’s picture

This test is needed to test load by properties. Please update its doc-blocks

--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LoadMultipleTest.php
+++ /dev/nullundefined

Please do not drop this test.

+++ /dev/nullundefined
@@ -1,71 +0,0 @@
-   * Create a vocabulary and some taxonomy terms, ensuring they're loaded
-   * correctly using taxonomy_term_load_multiple().
...
-    // Load the same terms again by tid.
-    $terms2 = taxonomy_term_load_multiple(array_keys($terms));

Just update here

andypost’s picture

Status: Needs review » Needs work
+++ /dev/nullundefined
@@ -1,71 +0,0 @@
- * Test the taxonomy_term_load_multiple() function.
...
-      'name' => 'Taxonomy term multiple loading',
...
-   * correctly using taxonomy_term_load_multiple().
...
-    $terms = entity_load_multiple_by_properties('taxonomy_term', array('vid' => $vocabulary->id()));
...
-    $terms2 = taxonomy_term_load_multiple(array_keys($terms));

So testing entity_load_multiple() and entity_load_multiple_by_properties()

daven’s picture

Patch no longer applies. But also I did the following grep, and the only result is the deprecated function definition.

grep -rsn "taxonomy_term_load_multiple(" .
./core/modules/taxonomy/taxonomy.module:682:function taxonomy_term_load_multiple(array $tids = NULL) {

So I believe this ticket is now obsolete.

worldlinemine’s picture

Assigned: xxAlHixx » worldlinemine
Issue summary: View changes

Note: the patches need to be modified because they include changes that were addressed as part of #2022509: Deprecate taxonomy_vocabulary_load_multiple() and taxonomy_term_load_multiple() in favour of entity_load_multiple(). The related issue addressed removing references to the wrapper function but left the wrapper function and tests intact in the taxonomy module code.

I asked myself "Should we complete removing the deprecated wrapper function (taxonomy_term_load_multiple) found here: core/modules/taxonomy/taxonomy.module [lines 682 to 684]?

I believe that yes, we should remove the function and it's related tests (LoadMultipleTest).

I'm working on the patch.

worldlinemine’s picture

Status: Needs work » Needs review
FileSize
4.08 KB

Created patch which removed the test file and edited taxonomy.module to remove unwanted wrapper function.

andypost’s picture

Suppose better remove usage of taxonomy_term_load_multiple_by_name here

worldlinemine’s picture

@Andypost given that taxonomy_term_load_multiple_by_name() is more then a wrapper function would it make sense to separate this out into a second issue so that we can complete removing taxonomy_term_load_multiple_by_name()?

Presently the function is found in the taxonomy.module, TermLanguageTest.php, VocabularyPermissionsTest.php, and TermTest.php which tests more then just taxonomy_term_load_multiple_by_name().

In the event all usage of taxonomy_term_load_multiple_by_name() should simply be removed from the 4 files mentioned above, I'd be happy to re-create the patch.

andypost’s picture

Title: Get rid of taxonomy_term_load_multiple() in favour of entity_load_multiple() » Deprecate taxonomy_term_load_multiple_by_name() in favour of entity_load_multiple_by_properties()
Issue tags: +@deprecated
ianthomas_uk’s picture

Title: Deprecate taxonomy_term_load_multiple_by_name() in favour of entity_load_multiple_by_properties() » Remove taxonomy_term_load_multiple() in favour of entity_load_multiple()
Assigned: worldlinemine » Unassigned
Status: Needs review » Reviewed & tested by the community

I've split taxonomy_term_load_multiple_by_name() out into #2197767: Remove uses of Deprecate taxonomy_term_load_multiple_by_name() in favour of entity_load_multiple_by_properties() and restored the original title (I don't understand why it was changed from one function to another in #10).

The function is not used, #7 still applies and does what it says it does, so RTBC.

xjm’s picture

Hm, so. We recently discussed leaving in the deprecated entity CRUD BC wrappers since we don't gain much other than poking people in the eye by removing them. Let's hold off on committing this until I can get confirmation on that point, at least.

ianthomas_uk’s picture

If that's the case, then #2187735: Add removal information to docblock of all @deprecated functions will need to be updated to reflect that. ("will be removed before Drupal 8.0" > "may be removed in Drupal 9.0")

Berdir’s picture

See #2190313: Add $EntityType::load() and loadMultiple() to simplify loading entities, which would allow us to remove or at least deprecate them in favor of something that does not result in reduced DX ( correct type hints for the specific entity type, easy way to call it in procedural code)

ianthomas_uk’s picture

Status: Reviewed & tested by the community » Needs review

I think #12 needs to be addressed before this is RTBC.

ianthomas_uk’s picture

andypost’s picture

Status: Postponed » Needs review
ianthomas_uk’s picture

Title: Remove taxonomy_term_load_multiple() in favour of entity_load_multiple() » Remove taxonomy_term_load_multiple() in favour of \Drupal\taxonomy\Entity\Term::loadMultiple().
Status: Needs review » Needs work

That patch won't apply any more.

We'll also need to update https://www.drupal.org/node/1413672 and ensure this is covered by a change record. IMO the best way to do that is to list the old and new functions on the change record for #2190313: Add $EntityType::load() and loadMultiple() to simplify loading entities.

parvind87’s picture

Status: Needs work » Needs review
Issue tags: +#SprintWeekend2015

I have searched for the function - "taxonomy_term_load_multiple()" into entire core drupal 8 and didnt find any usage of this function except the function declaration. Please review.

ianthomas_uk’s picture

Issue tags: -#SprintWeekend2015 +SprintWeekend2015

Fix tag. Please announce at your sprint that the right tag does not include a #.

shravan sonkar’s picture

I Have removed this function in taxonomy.module

lakshminp’s picture

Status: Needs review » Reviewed & tested by the community

#21 removes taxonomy_term_load_multiple() in taxonomy.module.

ianthomas_uk’s picture

Status: Reviewed & tested by the community » Needs work

Change records still haven't been done, see #18

Tebro’s picture

rpayanm’s picture

Status: Needs work » Needs review
Xano’s picture

Status: Needs review » Needs work

Thanks for working on this! At this point in the release cycle we can no longer remove functions like these, but we can replace all usages and mark them deprecated by adding @deprecated Deprecated as of Drupal 8.0.0. Use \Drupal\taxonomy\Entity\Term::loadMultiple() instead. to the function's docblock.

veerasekar89’s picture

Version: 8.0.x-dev » 9.x-dev
Status: Needs work » Postponed
Issue tags: +ChennaiSprintWeekend
+++ b/core/modules/taxonomy/taxonomy.module
@@ -473,29 +473,6 @@ function taxonomy_term_load_multiple_by_name($name, $vocabulary = NULL) {
- * @deprecated in Drupal 8.x, will be removed before Drupal 9.0.
- *   Use \Drupal\taxonomy\Entity\Term::loadMultiple().

there's already one

Xano’s picture

Version: 9.x-dev » 8.0.x-dev
Status: Postponed » Needs work

@timplunkett informed me that this annotation is wrong and all CRUD functions like these are in fact scheduled for removal before Drupal 8.0.0 comes out.

Status: Needs work » Needs review
andypost’s picture

alexpott’s picture

Version: 8.0.x-dev » 9.x-dev
Status: Reviewed & tested by the community » Postponed

We said we would remove this in 9.x and so we should.

catch’s picture

Version: 9.x-dev » 9.0.x-dev

The 9.0.x branch will open for development soon, and the placeholder 9.x branch should no longer be used. Only issues that require a new major version should be filed against 9.0.x (for example, removing deprecated code or updating dependency major versions). New developments and disruptive changes that are allowed in a minor version should be filed against 8.9.x, and significant new features will be moved to 9.1.x at committer discretion. For more information see the Allowed changes during the Drupal 8 and 9 release cycles and the Drupal 9.0.0 release plan.