bibcite_entity_update_8028 causes : "Mismatched entity and/or field definitions"

Created on 15 February 2022, almost 3 years ago
Updated 21 May 2024, 7 months ago

Hi,

After upgrading to drupal 9.3.5, I got this message in the "Status report" page :

Errors found
Entity/field definitions
Mismatched entity and/or field definitions
The following changes were detected in the entity type and field definitions.

Reference

  • The Abstract field needs to be updated.

None of these drush 10.6.2 commands could solve :

wwwetsf@d9-etsf:/var/www/drupal8$ drush -V
Drush Commandline Tool 10.6.2

wwwetsf@d9-etsf:/var/www/drupal8$ drush cr
 [success] Cache rebuild complete.

wwwetsf@d9-etsf:/var/www/drupal8$ drush updb
 [success] No pending updates.

wwwetsf@d9-etsf:/var/www/drupal8$ drush update:status --entity-updates
 ------------------------------- ----------- --------------- -----------------------------------------
  Module                          Update ID   Type            Description
 ------------------------------- ----------- --------------- -----------------------------------------
  bibcite_reference entity type               entity-update   The Abstract field needs to be updated.
 ------------------------------- ----------- --------------- -----------------------------------------
wwwetsf@d9-etsf:/var/www/drupal8$ drush entity:updates

In UpdateDBCommands.php line 117:

  Drupal removed its automatic entity-updates API in 8.7. See https://www.drupal.org/node/3034742.
πŸ› Bug report
Status

Needs work

Version

2.0

Component

Miscellaneous

Created by

πŸ‡§πŸ‡ͺBelgium jmbeuken Louvain-la-Neuve

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States caspervoogt

    I would also like to hear about this. I just ran into the same thing and had to use 'drush entup', after searching the admin UI fruitlessly for this Abstract field, which seems to be baked into the Bibcite module and not exposed in the admin UI. I looked through all my Bibcite types' fields, and elsewhere, before resorting to 'drush entup'.

    When I ran "drush db" this is what I saw:

    "bibcite_reference entity type :
    The Abstract field needs to be updated."

    So this is a field on the Bibcite module's entity type itself.

    It seems to me this 'Abstract' field update should be handled by a Bibcite module DB update, not Devel Entity Updates.

  • πŸ‡©πŸ‡ͺGermany Corn696 Flensburg

    The cause for this, is the change introduced by following issue:
    PubMed abst_e field - contains basic html (3079282) β†’

    The abstract fields (english and french) have been changed changed from text (long) to text (formatted, long).
    It seems that something is missing in the update hook for the english abstract field.

  • πŸ‡©πŸ‡ͺGermany Corn696 Flensburg
    • 8e8c61a5 committed on 3.0.x
      Issue #3264439: bibcite_entity_update_8028 causes : "Mismatched entity...
  • Status changed to Needs work 7 months ago
  • πŸ‡ΊπŸ‡ΈUnited States bkosborne New Jersey, USA

    This was committed back in December, but the issue was never set to fixed. Additionally, I don't think it received a proper review. This is the update hook that was committed:

    /**
     * Update entity definitions.
     */
    function bibcite_entity_update_8029() {
      $entity_type_manager = \Drupal::entityTypeManager();
      $entity_type_manager->clearCachedDefinitions();
    
      $entity_type_ids = [];
      $change_summary = \Drupal::service('entity.definition_update_manager')->getChangeSummary();
      foreach ($change_summary as $entity_type_id => $change_list) {
        $entity_type = $entity_type_manager->getDefinition($entity_type_id);
        \Drupal::entityDefinitionUpdateManager()->installEntityType($entity_type);
        $entity_type_ids[] = $entity_type_id;
      }
    
      return t("Installed/Updated the entity type(s): @entity_type_ids", [
        '@entity_type_ids' => implode(', ', $entity_type_ids),
      ]);
    }
    

    This is not the correct way of handling the problem.

    1. It uses the entity definition update manager to install entity types, but the entity types are already installed. It should use ->updateEntityType()
    2. It should not load all entity definitions that require and update! It should only modify those that the bibcite_entity module is responsible for. This is dangerous.
    3. It should not simply load the version of the entity definition from code and re-install/update it. It needs to figure out the precise change that is needed and apply that change instead. Otherwise, if someone updated from this version of bibcite to one in the future that also made changes to the entity definition, resetting the entity definition to the current code's representation may cause major conflicts and issues. That's why drush removed this "quick fix" command to begin with.

    This update hook should be modified to address the specific change in the entity definition that was needed.

Production build 0.71.5 2024