Needs work
Project:
Drupal core
Version:
main
Component:
entity system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
12 Apr 2018 at 20:39 UTC
Updated:
30 Jan 2023 at 20:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
amateescu commentedThe main idea of this patch is that it allows the table mapping to be instantiated with only a subset of the field storage definitions of an entity type. In this case, we only need the table information for a single field, the one that we want to query and count its data.
There's still at least one failure in
\Drupal\KernelTests\Core\Entity\EntityDefinitionUpdateTest::testBaseFieldDeleteWithExistingData()but I'd like to get some feedback on the general approach before spending more time on it :)Comment #3
amateescu commentedOops, forgot the patches.
Comment #5
amateescu commentedAn interesting thing to note here is that the current code of the
countFieldData()method, which makes a clear distinction between fields stored in dedicated vs. shared tables has caused a critical data loss bug in the past: #2559309: Logic error in SqlContentEntityStorage::countFieldData() drops dedicated field tables (again), with the only reason being that the original (also critical) issue forgot to take into account one of the if/else branches: #2527816: Logic error in SqlContentEntityStorage::countFieldData() attempts to drop `name` columnThe code simplification proposed in this issue would have prevented at least the second bug.
Comment #8
amateescu commentedNew patch based on #2955442-40: Add a way to get all the tables in which a field is stored from TableMappingInterface.
Comment #10
amateescu commentedNice, those fails are very easy to fix :)
Comment #18
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.