// @todo This is handled by ContentEntityStorageBase, which assumes
// FieldableEntityInterface. The current approach in
// https://www.drupal.org/node/1867228 improves this but does not solve it
// completely.
if ($entity instanceof FieldableEntityInterface
) { foreach ($entity as $name =>
$field) { if (isset($values[$name])) { $entity->
$name =
$values[$name];
} elseif (!
array_key_exists($name,
$values)) { $entity->
get($name)->
applyDefaultValue();
} unset($values[$name]);
} } return $entity;
} /**
* {@inheritdoc}
*/