Fix Container::reset() and provide DrupalKernel::resetContainer()

Created on 8 February 2024, 8 months ago
Updated 14 March 2024, 7 months ago

Problem/Motivation

In πŸ“Œ Add the ability to install multiple modules and only do a single container rebuild to ModuleInstaller Needs review we installing modules without rebuilding the container all the time. To do this we need to be able to reset the container so that any instantiated services can be re-instantiated. Unfortunately this runs into 2 problems:

  • \Drupal\Component\DependencyInjection\Container::reset() doesn't recreate the 'service_container' entry that was added in the constructor
  • We need an equivalent of \Drupal\Core\DrupalKernel::initializeContainer() that copies stuff from the old container to the new container - think synthetic services, logged in user and session.

Proposed resolution

  • Fix Container::reset() by not settings the circular reference but doing what Symfony does and adding hard coded 'service_container' in a few places
  • Add DrupalKernel::resetContainer()

Remaining tasks

User interface changes

None

API changes

New \Drupal\Core\DrupalKernel::resetContainer()

Data model changes

None

Release notes snippet

N/a

πŸ“Œ Task
Status

Fixed

Version

10.3 ✨

Component
BaseΒ  β†’

Last updated about 8 hours ago

Created by

πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024