Get rid of entity storages in class constructors

Created on 27 January 2024, 5 months ago
Updated 10 February 2024, 5 months ago

Problem/Motivation

Getting the storage in the class __construct method is a bad practice, as it creates problems with performance.

Steps to reproduce

For example, check the Drupal\private_message\Controller\AjaxController class. The threadManager property is being called like $this->threadManager = $entityTypeManager->getStorage('private_message_thread');

Proposed resolution

Get rid of the entity storages in constructors of classes.

πŸ“Œ Task
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine EvilArgest

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024