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?

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

1 Answer 1

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
  • 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, 2015 at 11:34

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