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.
As discussed in #1893772: Move entity-type specific storage logic into entity classes, loading is the wrong place to check for term access. We're not doing this for any other entity.
Comment | File | Size | Author |
---|---|---|---|
#9 | drupal-1919016-9.patch | 1.75 KB | dawehner |
#9 | interdiff.txt | 940 bytes | dawehner |
#5 | drupal-1919016-5.patch | 851 bytes | dawehner |
#2 | term-load-access-1919016-1.patch | 604 bytes | Berdir |
Comments
Comment #1
BerdirHere is a patch. I'm assuming that we have no test coverage for this...
Comment #2
BerdirGrml.
Comment #3
chx CreditAttribution: chx commentedYeah, loading is a very wrong place, it's entity cache incompatible to do that.
Comment #4
webchickNo longer applies.
Comment #5
dawehnerWe seem to be able to simplify this function a lot.
Comment #6
amateescu CreditAttribution: amateescu commentedYay for less code :)
Comment #7
xjmHa. Yes. For anyone that doesn't see it right away, all
TermStorageController::buildQuery()
was doing was adding the tag. If we aren't doing that anymore, we don't need to override the parent method.Comment #8
xjmFYI it looks like this was there in the original conversion in #1361232: Make the taxonomy entities classed objects and part of @Berdir's original patch, so there wasn't a specific reason it was introduced that we need to worry about as far as I can tell. Edit: Hmm, do we have any test coverage around the
term_access
tag at all? I don't think we do since core doesn't do anything with it it. Edit 2: Except that Views is in core now, and Views does! See incore/modules/taxonomy/taxonomy.views.inc
.I also noticed in the process of digging back as to why these lines are there that
core/lib/Drupal/Core/Entity/DatabaseStorageController.php
has a reference to this method on the parentbuildQuery()
method, so we need to update that documentation as well.Comment #9
dawehnerGood catch!
Comment #10
BerdirRe-roll looks good.
Initially, there was also a translatable tag but I removed that in another issue, so now we can remove the whole function yes. I really want to remove that other example there as well :)
Comment #11
xjmLet's add a followup to add some test coverage for the term access tag?
Comment #12
Berdir#1947270: Add test coverage for the term_access query tag
Comment #13
xjm#9: drupal-1919016-9.patch queued for re-testing.
Comment #14
xjmComment #15
webchickD'oh. Sorry, thought I had committed this long ago...
Committed and pushed to 8.x. Thanks!