By alexpott on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.8.x
Introduced in version:
8.8.1
Issue links:
Description:
The ConfigEntityUpdate class can only update one entity type per update hook. Prior to this change the update would appear to be successful but the first update might not actually update all the entities it should.
The ConfigEntityUpdater will now throw an exception for a problematic update. As a fix, all but the last entity type must be split up into separate update functions so that they are executed again. The logic must take care of handling sites where the update was already (partially) executed.
Before
function my_module_post_update_fix_something(&$sandbox = NULL) {
\Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'block', function ($entity) use ($something) {
return do_something($entity);
});
\Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'action', function ($entity) use ($something_else) {
return do_something_else($entity);
});
}
After
function my_module_post_update_fix_something_block(&$sandbox = NULL) {
\Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'block', function ($entity) use ($something) {
return do_something($entity);
});
}
function my_module_post_update_fix_something_action(&$sandbox = NULL) {
\Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'action', function ($entity) use ($something_else) {
return do_something_else($entity);
});
}
Impacts:
Module developers
Site templates, recipes and distribution developers