Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ContentEntityBase.php

function ContentEntityBase::__sleep

Overrides EntityBase::__sleep

File

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

Class

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

Namespace

Drupal\Core\Entity

Code

public function __sleep() : array {
    // Get the values of instantiated field objects, only serialize the values.
    foreach ($this->fields as $name => $fields) {
        foreach ($fields as $langcode => $field) {
            $this->values[$name][$langcode] = $field->getValue();
        }
    }
    $this->fields = [];
    $this->fieldDefinitions = NULL;
    $this->languages = NULL;
    $this->clearTranslationCache();
    return parent::__sleep();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal