Problem/Motivation
The code from SqlContentEntityStorageSchemaConverter was somewhat generic but mostly targeted for converting an entity type from non-revisionable to revisionable, and it had a big flaw: it was relying on live (in-code) entity type and field storage definitions for the conversion process.
We managed to change that code to be completely agnostic of the conversion type and not use the live definitions anymore in #2984782: Add an API for converting entity type schemas to (non-)revisionable/(non-)translatable, with or without data, so SqlContentEntityStorageSchemaConverter does not have any purpose to exist anymore :)
Proposed resolution
Make SqlContentEntityStorageSchemaConverter a slim wrapper around the new API for converting entity type schemas.
Remaining tasks
- make SqlContentEntityStorageSchemaConverter use the new API from #2984782: Add an API for converting entity type schemas to (non-)revisionable/(non-)translatable, with or without data internally
- mark it as deprecated
- rework its test coverage to test the new API instead
User interface changes
Nope.
API changes
Nope.
Data model changes
Nope.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | interdiff-14.txt | 2.91 KB | amateescu |
| #14 | 3004642-14.patch | 44.85 KB | amateescu |
| #10 | interdiff-10.txt | 3.49 KB | amateescu |
| #10 | 3004642-10.patch | 43.01 KB | amateescu |
| #8 | interdiff-8.txt | 17.76 KB | amateescu |
Comments
Comment #2
amateescu commentedThis patch is split from #2984782-15: Add an API for converting entity type schemas to (non-)revisionable/(non-)translatable, with or without data and does the first item from the list of remaining tasks.
Comment #3
amateescu commentedUpdated the patch for the changes in #2984782-39: Add an API for converting entity type schemas to (non-)revisionable/(non-)translatable, with or without data.
\Drupal\Tests\system\Functional\Entity\Update\SqlContentEntityStorageSchemaConverterTranslatableTest::testMakeRevisionableErrorHandling()needs some work becauseentity_test_update_entity_presave()is not invoked anymore.Comment #4
amateescu commentedComment #5
amateescu commentedThe blocker is in, let's run this through the testbot.
Comment #7
amateescu commentedFixed the fails and cleaned up a few more things.
Comment #8
amateescu commentedAnd, as promised in #2984782-53: Add an API for converting entity type schemas to (non-)revisionable/(non-)translatable, with or without data (point 2), moved the error handling test coverage to the new test class.
This is now ready for final reviews :)
Comment #10
amateescu commentedThe fail from #7 is a very good example why we don't want to run arbitrary hooks during the 'restore' process :/
Comment #11
amateescu commentedAlso opened #3030086: Clean up content_translation_entity_presave() for the bug discovered by #7.
Comment #13
plachLooks good! I found only a minor issue:
Missing
@trigger_error+ deprecation test.Also, missing CR reference.
Comment #14
amateescu commentedGood points, done!
Comment #15
plachCool, thanks!
Comment #16
plachThis is semi-blocking #2976035-59: Entity type CRUD operations must use the last installed entity type and field storage definitions , so it is at very least major.
Comment #18
amateescu commentedRandom test fail.
Comment #19
catchCommitted 57de633 and pushed to 8.7.x. Thanks!
Comment #21
plachThanks!