Problem/Motivation

The BlockContent entity type is translatable and revisionable, but it doesn't declare its revision data table in the annotation.

Proposed resolution

Fix it.

Remaining tasks

Review.

User interface changes

Nope.

API changes

Nope.

Data model changes

Nope.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amateescu created an issue. See original summary.

amateescu’s picture

Status: Active » Needs review
FileSize
1.53 KB

Let's fix it.

jibran’s picture

Let's add some tests.

Status: Needs review » Needs work

The last submitted patch, 2: 2858109.patch, failed testing.

amateescu’s picture

Status: Needs work » Needs review
FileSize
3.34 KB
1.81 KB

The problem discovered by this patch is that if an entity type doesn't specify a base table in its definition, the entity storage will create it anyway because it needs it but the entity type definition can no longer be updated to include the table name.

This is one way of fixing it but I'm not entirely happy with it :/

jibran’s picture

I still think we should add a test to check that entity definition is updated after running update hook.

amateescu’s picture

Ok. Since update path tests are expensive, let's re-use the existing one and add a couple of assertions to it.

The test-only patch is also the interdiff.

The last submitted patch, 7: 2858109-7-test-only.patch, failed testing.

jibran’s picture

Status: Needs review » Reviewed & tested by the community

Awesome!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 85860ba to 8.4.x and c1eaa26 to 8.3.x. Thanks!

diff --git a/core/modules/block_content/block_content.install b/core/modules/block_content/block_content.install
index 97c3362..6af2ac4 100644
--- a/core/modules/block_content/block_content.install
+++ b/core/modules/block_content/block_content.install
@@ -63,11 +63,6 @@ function block_content_update_8003() {
 }
 
 /**
- * @addtogroup updates-8.3.x
- * @{
- */
-
-/**
  * Fix the block_content entity type to specify its revision data table.
  */
 function block_content_update_8300() {
@@ -77,7 +72,3 @@ function block_content_update_8300() {
   $definition_update_manager->updateEntityType($entity_type);
 
 }
-
-/**
- * @} End of "addtogroup updates-8.3.x".
- */

We've just removed all of these. See #2860096: Remove api doc groups for updates eg. updates-8.2.x-to-8.3.x

  • alexpott committed 85860ba on 8.4.x
    Issue #2858109 by amateescu: The BlockContent entity type does not...

  • alexpott committed c1eaa26 on 8.3.x
    Issue #2858109 by amateescu: The BlockContent entity type does not...
alexpott’s picture

Should we file a follow-up to help custom entities not get into the same position?

amateescu’s picture

Well, we can't write update functions for custom entities and the changing the storage to not create the tables automatically if they're not defined in the entity definition would be an API change..

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.