Support from Acquia helps fund testing for Drupal Acquia logo

Comments

voleger created an issue. See original summary.

voleger’s picture

Status: Needs review » Needs work

The last submitted patch, 3: 3000033-3.patch, failed testing. View results

Mile23’s picture

Status: Needs review » Needs work

Some minor stuff.

  1. +++ b/core/includes/entity.inc
    @@ -11,14 +11,15 @@
    + * @deprecated in Drupal 8.0.x and will be removed before Drupal 9.0.0. Use
    

    Needs a version update.

  2. +++ b/core/lib/Drupal/Core/Entity/EntityTypeManager.php
    @@ -262,4 +262,15 @@ public function createHandlerInstance($class, EntityTypeInterface $definition =
    +    foreach ($this->getDefinitions() as $entity_type => $info) {
    

    A little more readable, since we don't use $info, and maybe save some memory:
    foreach (array_keys($this->getDefinitions) as $entity_type) {

voleger’s picture

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Looks great, all the nits in #6 were fixed.

voleger’s picture

Assigned: voleger » Unassigned
catch’s picture

Status: Reviewed & tested by the community » Needs work

This isn't being called anywhere in core, why not deprecate it without a replacement?

Mile23’s picture

Status: Needs work » Needs review

Because public API.

Berdir’s picture

> 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.

Berdir’s picture

Status: Needs review » Needs work

Also the new method does not make sense, it's way too unspecific about what it really does to be on EntityTypeManagerInterface.

Berdir’s picture

Status: Needs work » Needs review

More 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.

Berdir’s picture

Status: Needs review » Needs work

Lovely, crosspost with myself.

voleger’s picture

Status: Needs work » Needs review
FileSize
1.04 KB
2.79 KB

Here the updated patch. Also, CR was updated.

Berdir’s picture

Status: Needs review » Needs work
  1. +++ b/core/includes/entity.inc
    @@ -11,8 +11,17 @@
    + * @deprecated in Drupal 8.7.x and will be removed before Drupal 9.0.0. Instead,
    + * use \Drupal\Core\Entity\EntityViewBuilderInterface::resetCache() on
    + * the required entity types.
    

    I'd add .. "or invalidate specific cache tags."

  2. +++ b/core/includes/entity.inc
    @@ -11,8 +11,17 @@
     function entity_render_cache_clear() {
    +  @trigger_error('() is deprecated. Use \Drupal\Core\Entity\EntityViewBuilderInterface::resetCache() on the required entity types instead. See https://www.drupal.org/node/3000037', E_USER_DEPRECATED);
       $entity_manager = Drupal::entityManager();
    

    function is missing in the message.

voleger’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
1.12 KB
1.25 KB

Oh, sure. Thanks.

voleger’s picture

Status: Reviewed & tested by the community » Needs review

wrong status

Berdir’s picture

Status: Needs review » Reviewed & tested by the community

Good. Maybe also include an explicit cache tag example or reference the cache tag/cacheablity documentation in the change record, but the patch looks fine.

voleger’s picture

Updated CR with a link to related cache api documentation.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 2e30a3c and pushed to 8.7.x. Thanks!

diff --git a/core/includes/entity.inc b/core/includes/entity.inc
index 07d001e6f9..1e21c3562d 100644
--- a/core/includes/entity.inc
+++ b/core/includes/entity.inc
@@ -13,8 +13,8 @@
  * Clears the entity render cache for all entity types.
  *
  * @deprecated in Drupal 8.7.x and will be removed before Drupal 9.0.0. Instead,
- * use \Drupal\Core\Entity\EntityViewBuilderInterface::resetCache() on
- * the required entity types or invalidate specific cache tags.
+ *   use \Drupal\Core\Entity\EntityViewBuilderInterface::resetCache() on the
+ *   required entity types or invalidate specific cache tags.
  *
  * @see https://www.drupal.org/node/3000037
  * @see \Drupal\Core\Entity\EntityViewBuilderInterface::resetCache()

Fixed the comment flow and indentation on commit.

  • alexpott committed 2e30a3c on 8.7.x
    Issue #3000033 by voleger, Berdir, Mile23, catch: Deprecate...

Status: Fixed » Closed (fixed)

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