Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
taxonomy_vocabulary_load_multiple() and taxonomy_term_load_multiple() are useless wrappers to entity_load_multiple()
Proposed resolution
Replace calls to corresponding:
taxonomy_vocabulary_load_multiple($vids) => entity_load_multiple('taxonomy_vocabulary', $vids)
taxonomy_term_load_multiple($tids) => entity_load_multiple('taxonomy_term', $tids)
Remaining tasks
- Commit a patch
- Update change notice https://drupal.org/node/1972410
Comment | File | Size | Author |
---|---|---|---|
#58 | 2022509-delete-entity-load-58.patch | 29.32 KB | effulgentsia |
#53 | 2022509-delete-entity-load-52.patch | 29.33 KB | hussainweb |
#52 | 2022509-delete-entity-load-52.patch | 29.33 KB | hussainweb |
#48 | interdiff.txt | 884 bytes | penyaskito |
#48 | 2022509-delete-entity-load-48.patch | 30.43 KB | penyaskito |
Comments
Comment #1
StephaneQComment #2
andypostawesome! please remove functions as well
Comment #3
StephaneQComment #4
andypostgreat!
Comment #5
Dries CreditAttribution: Dries commentedIt doesn't look like this patch applies anymore; it needs a re-roll.
In addition, it would be best to include the single load conversion as well.
Comment #6
StephaneQOk, I reworked it, I did the single load replacement.
Comment #8
andypostGreat to get more clean-up on this!
taxonomy_term_load()
andtaxonomy_vocabulary_load()
should be removed because they are introduced as menu-loaders that should be replaces with symfonyComment #9
StephaneQI removed these functions but tests failed because some modules still use them, should I resubmit patch without removing these functions?
Comment #10
andypostPlease remove the usage of the functions but leave them in taxonomy module!
This functions should not be removed, because they used by hook_menu() as wildcard loaders
Comment #11
hussainwebRestoring those functions.
Comment #13
hussainweb#11: entity_load_multiple-2022509-11.patch queued for re-testing.
Comment #15
andypostJust a bit of tests still broken
Comment #16
Soul88Fixed a bit the patch above and tested localy the tests that failed before. Seems to be ok now.
Comment #17
Soul88Changed the status.
Comment #18
andypostre-roll for current HEAD
Comment #19
andypostthere's still some places to fix
Comment #20
andypostComment #21
Soul88Cleaned up most of the things. But I'm not sure what should I do with the hooks? Delete them?
hook_taxonomy_term_load
hook_taxonomy_vocabulary_load
and in VocabularyFormController.php 35 to 43 lines:
Comment #22
andypostYou have noting to do with hooks just drop functions
taxonomy_vocabulary_load_multiple
andtaxonomy_term_load_multiple
Comment #23
lslinnet CreditAttribution: lslinnet commentedTaking a look at removing the last unused functions.
Should the title and problem be updated to reflect the change to also include taxonomy_term_load and taxonomy_vocabulary_load?
Comment #24
lslinnet CreditAttribution: lslinnet commentedTried removing the functions, but we are in a situation where removing those breaks the legacy routing as it attempts to call taxonomy_term_load when there is a %taxonomy_term in a menu path - and of course the same for taxonomy_vocabulary.
I have marked the functions as deprecated and will see if I can find related issues regarding the routing system and request that they remove the load function when converting to the new routing handling.
Comment #25
andypost@lslinnet see comment #22 you just need to drop 2 functions (*_load_multiple) that is not used in routing, also no reason to mark deprecated *_load()
Comment #26
Soul88New patch, where taxonomy_vocabulary_load_multiple() and taxonomy_term_load_multiple() functions were deleted.
Comment #28
hussainweb#26: entity_load_multiple-2022509-26.patch queued for re-testing.
Comment #29
andypostAwesome!
Comment #30
PanchoHmm, why don't follow Islinnet's proposal in #23/#24 and deprecate
taxonomy_vocabulary_load()
andtaxonomy_term_load()
? It could then be removed at a later point as soon as no more needed by the legacy code.Otherwise looks great, so +1!
Comment #31
andypost@Pancho because this functions as a lot of others are used as menu wildcard loaders. And while hook_menu() is here they could not be deprecated
Comment #32
lslinnet CreditAttribution: lslinnet commented@andypost had a talk with fubhy-the-cat earlier today regarding this and the load functions should as far as i understood on him should be considered deprecated.
They are currently only used for loading doing the legacy handling of the menu router and shouldn't be used for anything else - in that sense marking them as deprecated makes sense.
Comment #33
lslinnet CreditAttribution: lslinnet commentedAnd here is the patch for it.
Comment #34
PanchoOK, I was thinking about the post-hook_menu era, but we probably don't want to build up more pressure and, in the end, technical debt. So fine - Rome wasn't built in a day... :)
Comment #35
YesCT CreditAttribution: YesCT commentedThis issue was RTBC and passing tests on July 1, the beginning of API freeze.
Comment #36
catchIt doesn't make sense to mark taxonomy_vocabulary_load() deprecated in the same patch as removing taxonomy_term_load(). Let's mark the taxonomy_term wrappers deprecated as well rather than removing them for now. The one line deprecated function isn't a lot of overhead and it's easy to remove as long as nothing in core uses it.
Comment #37
Soul88Catch, I think the idea is that we:
1. totally remove taxonomy_vocabulary_load_multiple() and taxonomy_term_load_multiple() functions as they're nor used any more.
2. remove all the usages taxonomy_vocabulary_load() and taxonomy_term_load() except for the one in hook_menu.
3. Mark the latter 2 functions deprecated, cause they're left for compatibility with hook_menu only.
So it seems that no one marks taxonomy_vocabulary_load() as deprecated and removes taxonomy_term_load() in the same patch.
If I misunderstood something - please clarify what did you mean?
Comment #38
catchOh I get it now. I mis-read the patch :(
However I think we should just mark the _multiple() versions deprecated now we're past API freeze.
There's other places we'll be removing API functions still, but in those cases they're duplicating something else as opposed to simply wrapping it so mean real technical debt if they're left in (i.e. not one line). These functions were redundant in Drupal 7 too.
Comment #39
Soul88Here is another patch, that instead of removing "taxonomy_*_multiple" functions marks them as deprecated and deletes all their usages across the code. I think if it passes the test it's RTBC automatically?!
P.S. Of course it's up to you to decide, but I don't understand why wouldn't we want to drop the function that are not used. Is it because of API freeze? (I thought that changes are still allowed to be made by the patches that were RTBC by 1 july...)
Comment #40
catchI'm reticent to remove the function because we still have node_load_multiple(), user_load_multiple() and various others in core, which aren't even marked deprecated yet. The patch as it stands leaves us with some entity_load*() wrappers removed, some deprecated, some not across core as a whole which is introducing inconsistency rather than reducing it. Also in terms of leaving anything @deprecated in Drupal 8, one line wrappers would be the thing I'm least concerned about (compared to for example theme functions which also bloat the theme registry - i.e. they're not just a function).
There's a bit of a window for removing deprecated APIs within code freeze, but if we do that for these I'd rather do it all at once or not at all.
Comment #41
PanchoI agree with @catch:
we should either remove all of these functions or leave them all in.
But in any case the first step would be deprecating the functions and changing all implementations to entity_load*(). This is what #39 does, and therefore I'm very much for moving this solution forward. Didn't review the patch though.
Comment #42
Soul88I think I could continue and make the same changes for node_load and user_load. But first I'd like you, the core guys, to make a decision whether we should do it. Cause I wouldn't like to spend my time on something that would get declined because of API freeze/other inconsistencies.
so
1. Are we only limited to changes with node_load/node_load_multiple + user_load/user_load_multiple?
2. Should I extend this patch or just leave for D9?
P.S. Or maybe you could point me to someone whom I could ask my first question?
Comment #43
catchMarking things deprecated at this point is fine since it doesn't break any existing code at all. Doesn't have to be done here, could open separate issues.
Removal of one-line wrappers at this point I'm less keen on since they do little harm compared to a lot of other things - especially in the case of $entity_*load() functions since those are used so widely. I pinged alexpott about this issue as well to get his opinion.
Comment #44
alexpottAt the moment I'm in favour of just deprecating all of the entity_load*() wrappers.
However, if we complete all the deprecations and have no usages in core before beta then I'm also happy to remove them at that point as we then have less functions which is a good thing. The fact they were redundant in Drupal 7 makes me more included to remove them all before beta too... they are just technical debt.
Patch looks good to me.
Comment #45
andypost+1 to RTBC, Suppose we need a meta-issue to collect removal/deprecate of all wrappers
Comment #46
Pancho#39: entity_load_multiple-2022509-39.patch queued for re-testing.
Comment #48
penyaskitoRerolled.
Comment #49
lslinnet CreditAttribution: lslinnet commentedHave tested it, works as advertised. Code wise it looks good, haven't been able to spot any place that have been missed.
Comment #50
Soul88+1 for RTBC
Comment #51
alexpottNeeds a reroll...
Comment #52
hussainwebRerolling... The conflict was introduced in #1946456: Convert taxonomy_term_confirm_delete() and taxonomy_vocabulary_confirm_delete() to the new form interface.
Comment #53
hussainwebRerolling... The conflict was introduced in #1946456: Convert taxonomy_term_confirm_delete() and taxonomy_vocabulary_confirm_delete() to the new form interface.
Comment #54
shnark CreditAttribution: shnark commentedThe most recent patch applied, so I'm removing needs reroll tag.
Comment #55
penyaskitoBack to RTBC. After patching, grep returns only the function definitions and are marked as deprecated. Tests are green.
Comment #56
penyaskitoTrasgus everywhere, removing tag.
Comment #57
alexpott:(
Comment #58
effulgentsia CreditAttribution: effulgentsia commentedStraight reroll. Back to RTBC.
Comment #59
effulgentsia CreditAttribution: effulgentsia commentedComment #60
catchCommitted/pushed to 8.x, thanks!
Comment #61
catchComment #62
andypostupdated change notice https://drupal.org/node/1972410/revisions/view/2652156/2784587
Comment #64
worldlinemine CreditAttribution: worldlinemine commentedI was working on #2010138: Remove taxonomy_term_load_multiple() in favour of \Drupal\taxonomy\Entity\Term::loadMultiple(). and I am in agreement with comment #5 as the use of the deprecated function appears to have been eliminated from the the code. Using git blame this change appears to have occurred in commit c595d95475d74d247fdf42247255b9e5c0f494a1 which was related to this issue #2022509: Deprecate taxonomy_vocabulary_load_multiple() and taxonomy_term_load_multiple() in favour of entity_load_multiple().
So adding related issue.
Comment #65
andypost