Problem/Motivation

We like how configuration dependency system works. We like onDependencyRemoval(), but we miss so much an onDependencyUpdating().

Proposed resolution

Allow configuration entities to react on their dependencies update:

  • Add a new listener onDependencyUpdating() on config entities.
  • Assure BC for Drupal 8.
  • One use-case conversion: In editor.module, convert editor_filter_format_presave() (hook_ENTITY_TYPE_presave()) in Editor::onDependencyUpdating(). This hook implementation has already tests.

Remaining tasks

  • Fill an issue for D9 to remove the BC layer.
  • Discuss the opportunity to add more fine grained events: onEnable, onDisable, onIdRename, etc.

User interface changes

None.

API changes

New interfaces and methods:

ConfigManagerDependencyFinderInterface implemented by ConfigManager

  • getConfigEntitiesToChange()

ConfigEntityDependencyResolverInterface implemented by ConfigEntityBase

  • onDependencyUpdating()
  • setDependencyResolved()
  • isDependencyResolved()

Data model changes

None.

Comments

claudiu.cristea created an issue. See original summary.

claudiu.cristea’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new22.55 KB

A first PoC patch. the test is already there, in the Editor module.

Status: Needs review » Needs work

The last submitted patch, 2: 2647576-2.patch, failed testing.

claudiu.cristea’s picture

Status: Needs work » Needs review
StatusFileSize
new4.13 KB
new24.92 KB

Fixed unit tests.

Status: Needs review » Needs work

The last submitted patch, 4: 2647576-4.patch, failed testing.

claudiu.cristea’s picture

Title: Resolve config dependency updates » React on config dependency updating - aka onDependencyUpdating()
Issue summary: View changes
Status: Needs work » Needs review
Issue tags: +Needs tests
StatusFileSize
new11.78 KB
new27.32 KB

Closer...

claudiu.cristea’s picture

Title: React on config dependency updating - aka onDependencyUpdating() » onDependencyUpdating() - React on dependency updating
Issue summary: View changes

IS, title.

claudiu.cristea’s picture

Issue summary: View changes
claudiu.cristea’s picture

Issue tags: -Needs tests
StatusFileSize
new32.68 KB
new10.57 KB

Added tests, fixed docs.

claudiu.cristea’s picture

Issue summary: View changes

IS.

claudiu.cristea’s picture

StatusFileSize
new33 KB
new5.6 KB

More docs fixes.

claudiu.cristea’s picture

StatusFileSize
new36.19 KB
new11.18 KB

Improved the kernel test to test cascading updates. Other doc fixes.

Status: Needs review » Needs work

The last submitted patch, 12: ondependencyupdating-2647576-12.patch, failed testing.

claudiu.cristea’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new36.22 KB
new799 bytes

Fixed the unit test.

claudiu.cristea’s picture

StatusFileSize
new8.91 KB
new36.54 KB

Other docs fixes.

dawehner’s picture

Too tired to do a proper review now, sorry.

It would be nice if the issue summary could describe the usecase here ...

+++ b/core/lib/Drupal/Core/Config/ConfigManager.php
@@ -297,39 +298,44 @@ public function findConfigEntityDependentsAsEntities($type, array $names, Config
-      /** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $dependent */
+      /** @var \Drupal\Core\Config\Entity\ConfigEntityBase $dependent */

Mh, is that really an assumption we can make? What happens if people have different config entities? IMHO we need instanceof checks

claudiu.cristea’s picture

Assigned: Unassigned » alexpott

@alexpott, while you wrote the dependency management I would like to hear an opinion on this patch. The tests are passing nice and there's no BC break.

Status: Needs review » Needs work

The last submitted patch, 15: ondependencyupdating-2647576-15.patch, failed testing.

claudiu.cristea’s picture

Issue tags: +Needs reroll
kostyashupenko’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new36.53 KB

Status: Needs review » Needs work

The last submitted patch, 20: ondependencyupdating-2647576-20.patch, failed testing.

claudiu.cristea’s picture

kostyashupenko’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new36.86 KB

Reroll of #15. Needs review, because a lot new changes for the files in this patch, that came from 12 jan 2016. There were a lot of conflicts, while I was doing this reroll

Status: Needs review » Needs work

The last submitted patch, 23: ondependencyupdating-2647576-23.patch, failed testing.

claudiu.cristea’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 23: ondependencyupdating-2647576-23.patch, failed testing.

claudiu.cristea’s picture

Status: Needs work » Needs review
StatusFileSize
new22.15 KB

This is not an easy reroll.

Status: Needs review » Needs work

The last submitted patch, 27: 2647576-27.patch, failed testing.

claudiu.cristea’s picture

Status: Needs work » Needs review
StatusFileSize
new34.53 KB

Sorry, the patch was incomplete.

Status: Needs review » Needs work

The last submitted patch, 29: ondependencyupdating-2647576-29.patch, failed testing.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

alexpott’s picture

Assigned: alexpott » Unassigned

I'm not sure we need this extra level. The entity hooks already allow us to hook into an entity save. The dependency removal stuff is a special situation. Is there anything this new event would allow us to do we can't at the moment?

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.