Problem/Motivation

EntityDefinitionUpdateManager::installFieldableEntityType() calls setProvider($entity_type->getProvider()) on every field storage definition received. That discards the provider EntityFieldManager already assigned to fields added through hook_entity_base_field_info(), and the wrong provider is written to the last-installed field storage definitions.

Steps to reproduce

  • drush en entity_schema_test
  • drush en entity_test_update
  • drush php:eval "print \Drupal::service('entity.last_installed_schema.repository')->getLastInstalledFieldStorageDefinitions('entity_test_update')['custom_base_field']->getProvider();" prints entity_test_update instead of entity_schema_test.

Proposed resolution

  • Keep the provider already set on the field storage definition.
  • Add system_post_update_fix_base_field_providers() to repair existing sites by comparing each installed provider against the current one.

Remaining tasks

Review.

User interface changes

Nope.

Introduced terminology

N/A

API changes

Nope.

Data model changes

Nope.

Release notes snippet

N/A

Issue fork drupal-3624771

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

amateescu created an issue. See original summary.

amateescu’s picture

Issue summary: View changes
Status: Active » Needs review

This should do it.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new91 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

amateescu’s picture

Status: Needs work » Needs review
Issue tags: +no-needs-review-bot

Not sure what's up with the bot.

catch’s picture

One question - does this cause the status report to say that there's an entity definition mis-match, or is provider not taken into account there? Not sure it matters either way - it wouldn't be possible for site owners or module authors to fix anyway, just wondering.

amateescu’s picture

The provider is not taken into account there, so nothing changes on the status report page :)