-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mismatched field definitions in status report #500
Comments
This code seems to work, the 4 errors are gone: function MODULENAME_install() {
$etm = \Drupal::entityTypeManager();
$entity_type = $etm->getDefinition('node');
$edum = \Drupal::entityDefinitionUpdateManager();
/** @var BaseFieldDefinition[] $fields */
$fields = oe_content_entity_base_field_info($entity_type);
foreach ($fields as $field_name => $field_storage_definition) {
$edum->installFieldStorageDefinition(
$field_name,
'node',
'oe_content',
$field_storage_definition);
}
} This is a Observed database changes after running this operation:
I don't know yet what to do about |
@brummbar This could be something wrong with the specific project I am working on. For now we are going to fix this with a custom module update hook within the project. The other one, for oe_timeline, should be fixed in oe_content. For now we are going to use the PR as a patch. |
(I think I can find a solution myself, but having it here can be useful for others who have the same problem.)
Problem
We have the following error in the status report:
After upgrading to Drupal 9, we get this additional warning:
Investigation
With some investigation, I found that:
oe_content
module declares some base fields inoe_content_entity_base_field_info()
.oe_content
was first installed with a version that did not have these base fields, the fields will never be installed, and the warning will show up in the status report.config/sync/core.base_field_override.node.data.oe_content_navigation_title.yml
. Not sure how these affect the situation.Solution
I found this change record in drupal.org with instructions:
https://www.drupal.org/node/3034742 "Support for automatic entity updates has been removed"
We can add a hook_update_N() in a custom module to install these fields.
However, I wonder, shouldn't this be done by oe_content module?
Putting this in a custom module can be good enough in practice, but is conceptually wrong, because the custom module does not own these fields. It can lead to unreliable results if we install and uninstall the custom module (depends if we put it in an install hook or an update hook).
The text was updated successfully, but these errors were encountered: