7

This is a Drupal 8 (beta 15) site, basic, few content types. On the status report page it says:

Entity/field definitions
    Mismatch detected
    Mismatched entity and/or field definitions.

After investigation it turned out, this is caused by a few fields. The Drupal\Core\Entity\EntityDefinitionUpdateManager::getChangeList() is reporting them, because their original storage definition is missing from the key_value table for the column-collection: entity.storage_schema.sql

(The column-collection = config.entity.key_store.field_config entry is there for all fields.)

My question is - how can we fix this? All configuration is stored in configuration files (staging directory) - including all fields yml files. The configuration manager reports no difference, export will keep the files the same, and import will not change anything. drush updb will report no updates as well.

Is there a command we should call in an update hook to sync/register this storage info? Any idea?

  • What is the result of getChangeList(), eg which fields and what are the statuses? – benjy Oct 21 '15 at 3:47
3

It will depend on what exactly is reported from getChangedList() but what is happening is that a module needs to update the entity schema with something like:

\Drupal::entityDefinitionUpdateManager()
->installFieldStorageDefinition('the_field_name', 'node', 'node', $field_storage_definition);

Everything you need to know is in the change record: https://www.drupal.org/node/2554097

There is also an effort underway to provide additional information on the status page: https://www.drupal.org/node/2554911

  • 1
    Brilliant, thank you. In case you want to make the snippet complete, this is how I got the definition: $fieldStorages = \Drupal::entityManager()->getFieldStorageDefinitions($entityTypeID); and \Drupal::entityDefinitionUpdateManager() ->installFieldStorageDefinition($fieldName, 'node', 'node', $fieldStorages[$fieldName]); – itarato Oct 21 '15 at 11:34

protected by kiamlaluno Nov 8 '15 at 6:23

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.