This is the code I am attempting to use to update a content type with a new field. When I run drush dbup
I get this error.
PHP Fatal error: Using $this when not in object context in EntityStoageBase.php.
function some_config_update_8101() {
if (!FieldConfig::load('image_byline')) {
$config_path = drupal_get_path('module', 'some_config') . '/config/install/field.field.node.main_image.field_image_byline.yml';
$data = Yaml::parse($config_path);
\Drupal::configFactory()->getEditable('field.field.node.main_image.field_image_byline')->setData($data)->save(TRUE);
$message .= "FieldConfig installed for module some_config.\n";
}
else {
$message .= "It didn't work!\n";
}
if (!FieldConfigStorage::load('image_byline')) {
$config_path = drupal_get_path('module', 'some_config') . '/config/install/field.storage.node.field_image_byline.yml';
$data = Yaml::parse($config_path);
\Drupal::configFactory()->getEditable('field.storage.node.field_image_byline')->setData($data)->save(TRUE);
$message .= "FieldConfigStorage installed for module some_config.\n";
}
else {
$message .= "That didn't work either!\n";
}
}
How is my code affecting the context of EntityStorageBase
, if I have not changed code in that file?