function ContentEntityBase::clearTranslationCache

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::clearTranslationCache()
  2. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::clearTranslationCache()
  3. 11.x core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::clearTranslationCache()

Clears entity translation object cache to remove stale references.

2 calls to ContentEntityBase::clearTranslationCache()
ContentEntityBase::__clone in core/lib/Drupal/Core/Entity/ContentEntityBase.php
Magic method: Implements a deep clone.
ContentEntityBase::__sleep in core/lib/Drupal/Core/Entity/ContentEntityBase.php

File

core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 540

Class

ContentEntityBase
Implements Entity Field API specific enhancements to the Entity class.

Namespace

Drupal\Core\Entity

Code

protected function clearTranslationCache() {
    foreach ($this->translations as &$translation) {
        unset($translation['entity']);
    }
}

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