Problem/Motivation
I ran an update from 8.7 alpha1 to beta1 and encountered the following fatal:
[notice] Update started: layout_builder_post_update_make_layout_untranslatable
Error: Call to a member function isTranslatable() on null in /data/app/core/modules/layout_builder/layout_builder.post_update.php on line 205 #0 /data/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(260): layout_builder_post_update_make_layout_untranslatable(Array)
...
Error: Call to a member function isTranslatable() on null in layout_builder_post_update_make_layout_untranslatable() (line 205 of /data/app/core/modules/layout_builder/layout_builder.post_update.php).
The field map reflects the layout_builder__layout
field existing in a bundle that was introduced and deleted early in the development cycle. The bundle isn't listed for any of the other fields.
Proposed resolution
- Be more defensive in
layout_builder_post_update_make_layout_untranslatable
to protect against incorrect field maps. - Figure out why the field isn't updated in the field map when a bundle is deleted.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#9 | 3046007.patch | 1.22 KB | alexpott |
#2 | 3046007-2.patch | 1.02 KB | Sam152 |
Comments
Comment #2
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext for Brisbane City Council commentedFirst part of the proposed resolution, to unblock updating.
Comment #3
tim.plunkettThis would be MUCH more desirable IMO...
Having fixed at least one bug in the field map during LB dev and hitting several more, I'm starting to think it can't be trusted...
Comment #4
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext for Brisbane City Council commentedYeah, making sure the field map is accurate when bundles are deleted would be preferable. It might also be worth making the update hook more defensive for sites that are already in that state though.
Comment #5
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedLet's open a followup to investigate why the field map was not properly updated when the bundle was deleted. We should probably start by adding test coverage to
EntityBundleListenerTest
.In the meantime, I think this patch is very helpful as a quick fix for the first patch 8.7.x patch release.
Comment #6
tim.plunkettSee also #2985882: Workaround for "Call to a member function getLabel() after enabling layout_builder" which is about the field map not matching what actually exists
Comment #8
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedComment #9
alexpottLet's add a comment that explains why.
Comment #10
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedThe comment makes sense to me, thanks @alexpott :)
Comment #11
alexpottSo let's add the defensive code but we definitely should continue to investigate how it gets out-of-sync - hopefully #2985882: Workaround for "Call to a member function getLabel() after enabling layout_builder" can fix this.
Committed and pushed 13cbe41170 to 8.8.x and 798d3cccbc to 8.7.x. Thanks!
Comment #14
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext for Brisbane City Council commentedOut of interest, is there is a reason the field map isn't regenerated on cache rebuild?