Drupal 8: Mismatched entity and/or field definitions

2.3k Views Asked by At

While trying to understand why my view is not displaying, I noticed the following error in the log:

enter image description here

I do not think it is possible to delete the URL alias from Taxonomy terms. At least I cannot find how to do this. I have, however gone through ALL of my taxonomy terms and removed the value for this field.

I have also done the following with Pathauto: enter image description here

Also, I have checked the report located at admin/reports/fields and can confirm that there are no entities that use a field called URL alias.

I have gone through each content item and ensured that they have the following setting (anyone know how to do this in bulk?). But still the error remains. enter image description here

Anyone know then how I can fix this strange error?

3

There are 3 best solutions below

0
On BEST ANSWER

Im not entirely sure what this command does, but it fixed the error:

drush updb --entity-updates
0
On

use the entity_update module or the devel_entity_updates module

0
On

Since https://www.drupal.org/node/2554097, the magic in Drupal core that took care of updating entity definitions is gone. drush updb --entiy-updates is an alternative to this but it is not a silver bullet. Instead, it is safer to write database updates.

Taking the screenshot at the top as an example, here is a database update that would delete those two field definitions:

/**
 * Fix taxonomy and node field definitions.
 *
 */
function mymodule_update_8101() {
  $manager = \Drupal::entityDefinitionUpdateManager();

  if ($field = $manager->getFieldStorageDefinition('alias', 'node')) {
    $manager->uninstallFieldStorageDefinition($field);
  }

  if ($field = $manager->getFieldStorageDefinition('alias', 'term')) {
    $manager->uninstallFieldStorageDefinition($field);
  }
}

Have a look at the rest of the available methods at https://www.drupal.org/node/2554097 in order to write database updates for each scenario.