public function EntityNG::__clone

Implements a deep clone.

File

drupal/core/lib/Drupal/Core/Entity/EntityNG.php, line 406
Definition of Drupal\Core\Entity\EntityNG.

Class

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

Namespace

Drupal\Core\Entity

Code

public function __clone() {
  foreach ($this->fields as $name => $properties) {
    foreach ($properties as $langcode => $property) {
      $this->fields[$name][$langcode] = clone $property;
      if ($property instanceof ContextAwareInterface) {
        $this->fields[$name][$langcode]
          ->setParent($this);
      }
    }
  }
}