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
Followup #2999721: [META] Deprecate the legacy include files before Drupal 9
Proposed resolution
Move function logic into the entity type manager service.
Remaining tasks
- move logic into appropriate service method
- deprecate function
API changes
New method in \Drupal\Core\Entity\EntityTypeManager
Comment | File | Size | Author |
---|---|---|---|
#18 | interdiff-3000033-16-18.txt | 1.25 KB | voleger |
#18 | 3000033-18.patch | 1.12 KB | voleger |
Comments
Comment #2
volegerFilled CR https://www.drupal.org/node/3000037
Comment #3
volegerComment #5
volegerComment #6
Mile23Some minor stuff.
Needs a version update.
A little more readable, since we don't use
$info
, and maybe save some memory:foreach (array_keys($this->getDefinitions) as $entity_type) {
Comment #7
volegerAddressed #6
Comment #8
borisson_Looks great, all the nits in #6 were fixed.
Comment #9
volegerComment #10
catchThis isn't being called anywhere in core, why not deprecate it without a replacement?
Comment #11
Mile23Because public API.
Comment #12
Berdir> Because public API.
How is that an argument?
This is a helper method from long ago, basically the beginnings of having cache tags. As @catch said, there are no calls to it, because there really isn't a use case to invalidate *all* rendered entities, 90% use case is a specific entity type, and most of that happens now automatically and implicitly by saving entities, view displays or so, another 8% is invalidating everything through the rendered or similar cache tags, and if there's really something left, someone can loop over it themself.
+1 to deprecate without replacement.
Comment #13
BerdirAlso the new method does not make sense, it's way too unspecific about what it really does to be on EntityTypeManagerInterface.
Comment #14
BerdirMore proof: http://grep.xnddx.ru/search?text=entity_render_cache_clear&filename=
Only 3 modules call this function, and they all should be invalidating the complete render cache or have their own cache tag IMHO.
Comment #15
BerdirLovely, crosspost with myself.
Comment #16
volegerHere the updated patch. Also, CR was updated.
Comment #17
BerdirI'd add .. "or invalidate specific cache tags."
function is missing in the message.
Comment #18
volegerOh, sure. Thanks.
Comment #19
volegerwrong status
Comment #20
BerdirGood. Maybe also include an explicit cache tag example or reference the cache tag/cacheablity documentation in the change record, but the patch looks fine.
Comment #21
volegerUpdated CR with a link to related cache api documentation.
Comment #22
alexpottCommitted 2e30a3c and pushed to 8.7.x. Thanks!
Fixed the comment flow and indentation on commit.