Problem/Motivation

Some services are declared with lazy: true and have a proxy class to instantiate them on demand.

For example, the plugin.cache_clearer service is lazy but it is always accessed directly from the container as follows:

\Drupal::service('plugin.cache_clearer')->clearCachedDefinitions();

The returned service is a lazy proxy to the real service, but calling clearCachedDefinitions() immediately negates any benefit of using the lazy proxy.

Steps to reproduce

Proposed resolution

Remove lazy: true and associated proxy classes from services that do not need to be lazy.
Use modern Symfony features such as tagged service iterators where they would be useful.

Remaining tasks

Identify which services this applies to.

User interface changes

API changes

Data model changes

Release notes snippet

Comments

longwave created an issue. See original summary.

longwave’s picture

Title: Remove some lazy proxy services » [meta] Remove some lazy proxy services
Category: Task » Plan

In fact let's make this a meta as we have some child issues already.

longwave’s picture

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.

longwave’s picture

Status: Active » Closed (duplicate)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.