public function EntityNG::__clone

Magic method: Implements a deep clone.

File

drupal/core/lib/Drupal/Core/Entity/EntityNG.php, line 567
Contains \Drupal\Core\Entity\EntityNG.

Class

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

Namespace

Drupal\Core\Entity

Code

public function __clone() {
  $this->bcEntity = NULL;
  foreach ($this->fields as $name => $properties) {
    foreach ($properties as $langcode => $property) {
      $this->fields[$name][$langcode] = clone $property;
      $this->fields[$name][$langcode]
        ->setContext($name, $this);
    }
  }
}