Closed (fixed)
Project:
Drupal core
Version:
8.4.x-dev
Component:
content_translation.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
22 Feb 2017 at 00:19 UTC
Updated:
13 Jul 2017 at 12:55 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
amateescu commentedThis should do the trick.
We also need to write tests for the update function, but for that we need a new test database dump which is also required in a few other issues, so I will post a separate issue for it.
Note that the patch depends on #2346019: Handle initial values when creating a new field storage definition, so I'm just setting it to NR in order to get some initial reactions on it.
Comment #3
amateescu commentedComment #4
amateescu commentedOk, now that we have the issue which adds new test db dumps, here's a test for this patch!
Now this depends on the following issues, so I'm posting a combined patch as well:
#2856808: Break out the 'entity_test_update' entity type into its own module and add additional test db dumps
#2841291: Fix NOT NULL handling in the entity storage and 'primary key' changes when updating the storage definition of an identifier field
#2346019: Handle initial values when creating a new field storage definition
No interdiff because the only change is the added test.
Comment #5
amateescu commentedAlso, there's no need for a test-only patch because we're introducing new functionality that cannot be tested without the other changes in the patch.
Comment #7
amateescu commentedOk, there are a few failures that need to be fixed but let's wait for some of the dependencies to land first.
Comment #8
jibranJust walk by review.
EDUM can be stored in a variable outside of the loop.
Should we use constants here?
Comment #9
amateescu commentedOnly one of the fails from #4 is caused by this patch: since content translation metadata fields always have initial data now,
TaxonomyTermViewTestneeds to remove all the nodes before trying to uninstall the CT module.Another fail is caused by me not using the latest version of the patch from the 'entity_test_update' issue, specifically the interdiff in #2856808-11: Break out the 'entity_test_update' entity type into its own module and add additional test db dumps.
And
ContextualFilterTestwas just a random fail.--
#8.1: Fixed.
#8.2: We don't have any constants to use there.
Comment #10
jibranThank you for addressing the feedback.
#8.2: I think
EntityPublishedInterfaceshould add those constants instead ofNodeInterfaceand should be used here. Toughts?Comment #11
amateescu commented@jibran, nope, we specifically designed
EntityPublishedInterfaceto *not* have constants for published/not published. You can read the issue that introduced it for more details :)Comment #12
amateescu commentedRerolled for #2860096: Remove api doc groups for updates eg. updates-8.2.x-to-8.3.x and all the dependencies.
Comment #14
amateescu commentedI forgot to include #2856808: Break out the 'entity_test_update' entity type into its own module and add additional test db dumps in the combined patch. This is not even funny anymore :(
Comment #16
jibran#2856808: Break out the 'entity_test_update' entity type into its own module and add additional test db dumps is fixed.
Comment #17
jibranI think it is only blocked on #2346019: Handle initial values when creating a new field storage definition which is blocked on #2841291: Fix NOT NULL handling in the entity storage and 'primary key' changes when updating the storage definition of an identifier field so postpone by 2.
Comment #18
amateescu commentedThis patch depends only on #2346019: Handle initial values when creating a new field storage definition now.
Comment #19
amateescu commented#2346019: Handle initial values when creating a new field storage definition is in!
Comment #20
timmillwoodStruggling to find any issues.
Comment #21
wim leersYeah, I don't know this code, but I have to say that this patch looks super solid :)
Comment #22
tstoecklerAwesome, thanks! Needs work for 3. only.
Minor, but you could avoid having to fetch the schema repository manually by doing
$entity_definition_update_manager->getFieldStorageDefinition(). I don't feel strongly about this, though, so feel free to leave as is.Minor, but any reason not to put the initial value directly after the default value?
Let's use
TRUEfor the initial value, as well.Comment #23
amateescu commentedRe #22:
1.
$entity_definition_update_manager->getFieldStorageDefinition()clones the definition object and, tbh, I'd rather not have that overhead in a memory sensitive place like an update function..2. and 3. Sure thing, fixed :)
Comment #24
tstoecklerPerfect, thank you!
Comment #25
timmillwoodComment #27
wim leersThat seems to not work:
Comment #28
amateescu commentedThat's easy to fix ;)
Comment #29
tstoecklerNice fix. I thought whether the elseif-branch should get the same treatment, and I think it should. But I also found it strange that the conditions are set up differently - i.e. I would have expected the elseif to be
$initial_valu_from_field && isset($initial_value_from_field[$field_column_name]). But that's a preexisting issue so shouldn't be tackled here, and, thus, maybe we should leave that entire branch alone. Not sure, so leaving at Needs review.Comment #30
amateescu commented@tstoeckler, the
elseifbranch doesn't need the same treatment because the value in$initial_value_from_field[$field_column_name]is provided by$table_mapping->getColumnNames()so it is always a string containing a table column name, not an arbitrary value provided in code like we have for$initial_value[$field_column_name].As for why the
ifchecks are different, that's becauseisset()doesn't throw any notices when looking for an non-existent array key, which can happen with$initial_value[$field_column_name], but for$initial_value_from_field[$field_column_name]we always know that the array key exists because the field types are the same so they have the exact same column names in their schema :)Comment #31
timmillwoodIt looks as though we're ready to go back to RTBC.
Comment #32
tstoecklerWow, thank you for #30!!! That makes a lot of sense, totally missed that the two are inherently different beasts. Awesome explanation. RTBC++
Comment #34
amateescu commentedRerolled for the conversion of
TaxonomyTermViewTestto a functional test.Comment #35
timmillwoodBack to RTBC then!
Comment #37
catchHad to double check drupal_schema_get_field_value() wasn't deprecated, it isn't. Issue for that is #2124069: Convert schema.inc to the update.update_hook_registry service (UpdateHookRegistry).
Patch looks great, couldn't find anything to complain about. Committed/pushed to 8.4.x, thanks!