Commit 805a22e9 authored by catch's avatar catch

Issue #2418587 by xjm, marthinal, AjitS, Wim Leers, neilmc, Berdir: Set entity...

Issue #2418587 by xjm, marthinal, AjitS, Wim Leers, neilmc, Berdir: Set entity values to NULL instead of using unset() method: unset() is misleading
parent dcc5beda
......@@ -50,7 +50,7 @@ public function get(EntityInterface $entity) {
}
foreach ($entity as $field_name => $field) {
if (!$field->access('view')) {
unset($entity->{$field_name});
$entity->set($field_name, NULL);
}
}
......
......@@ -199,8 +199,8 @@ public function testCreateNode() {
}
else {
// Changed and revision_timestamp fields can never be added.
unset($entity->changed);
unset($entity->revision_timestamp);
$entity->set('changed', NULL);
$entity->set('revision_timestamp', NULL);
}
$serialized = $this->serializer->serialize($entity, $this->defaultFormat, ['account' => $account]);
......@@ -299,7 +299,7 @@ public function testCreateUser() {
}
// Changed field can never be added.
unset($entity->changed);
$entity->set('changed', NULL);
$serialized = $this->serializer->serialize($entity, $this->defaultFormat, ['account' => $account]);
......
......@@ -52,7 +52,7 @@ public function testPatchUpdate() {
));
$patch_entity = entity_create($entity_type, $patch_values);
// We don't want to overwrite the UUID.
unset($patch_entity->uuid);
$patch_entity->set('uuid', NULL);
$serialized = $serializer->serialize($patch_entity, $this->defaultFormat, $context);
// Update the entity over the REST API.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment