- Issue created by @afinnarn
The "value" property on the EntityFieldFetchItem field type is marked as being needed, but I saw this note on "\Drupal\Core\Field\FieldItemInterface" as guidance for implementing the "schema" method:
Computed fields having no schema should return an empty array.
I think it is worth a shot to try removing the value property since it has no functionality in that class.
1. Return an empty array in EntityFieldFetchItem::schema().
2. Remove the value property from EntityFieldFetchItem::propertyDefinitions().
3. Add an update hook that deletes the existing value column.
example code for #3:
$field_names = \Drupal::entityTypeManager()
->getStorage('field_storage_config')
->loadByProperties(['type' => 'entity_field_fetch']);
foreach ($field_names as $field_name) {
$tables = [
'node__' . $field_name,
'node_revision__' . $field_name
];
foreach ($tables as $table) {
if (Drupal::database()->schema()->fieldExists($table, $field_name . '_value')) {
Drupal::database()->schema()->dropField($table, $field_name . '_value');
}
}
}
This might turn into more can-o-worms than it helps so maybe not worth the time. I tried to think of better ways to get rid of the value column in the update hook, but the way I proposed doesn't feel right...and I'm probably missing something that would cause errors.
Active
1.0
Code