protected function createAnotherEntity($key) { $duplicate =
$this->
getEntityDuplicate($this->entity,
$key);
// Some entity types are not stored, hence they cannot be reloaded.
if (get_class($this->entityStorage
) !== ContentEntityNullStorage::
class) { $duplicate->
set('field_rest_test', 'Second collection entity'
);
} $duplicate->
save();
return $duplicate;
} /**
* {@inheritdoc}
*/