function entity_render_cache_clear

Clears the entity render cache for all entity types.

Deprecated

in drupal:8.7.0 and is removed from drupal:9.0.0. Instead, use \Drupal\Core\Entity\EntityViewBuilderInterface::resetCache() on the required entity types or invalidate specific cache tags.

See also

https://www.drupal.org/node/3000037

\Drupal\Core\Entity\EntityViewBuilderInterface::resetCache()

\Drupal\Core\Entity\EntityTypeManagerInterface::getDefinitions()

File

core/includes/entity.inc, line 21

Code

function entity_render_cache_clear() {
    @trigger_error(__FUNCTION__ . '() is deprecated. Use \\Drupal\\Core\\Entity\\EntityViewBuilderInterface::resetCache() on the required entity types or invalidate specific cache tags instead. See https://www.drupal.org/node/3000037', E_USER_DEPRECATED);
    $entity_manager = Drupal::entityManager();
    foreach ($entity_manager->getDefinitions() as $entity_type => $info) {
        if ($entity_manager->hasHandler($entity_type, 'view_builder')) {
            $entity_manager->getViewBuilder($entity_type)
                ->resetCache();
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.