Problem/Motivation
We should not perform any logic (like retrieving entity storage handlers) while constructing services. The constructors are executed when the dependency injection container is built and this can have unintended side effects.
The constructor of SubscriptionManager.php breaks all sites updating from Commerce 3.2 to 3.3:
https://www.drupal.org/project/commerce/issues/3573220
Issue fork simplenews-3573781
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
velmir_taky commentedNice catch and clean fix, @jsacksick thanks!
Checked the MR locally — works as expected. Constructor no longer calls
getStorage(), storages are loaded lazily where needed. No regressions in tests, coding standards clean. LGTMComment #5
adamps commentedWe could equally say that the update of Commerce breaks all sites using SubscriptionManager.php. It was after all the Commerce code that changed.
However I agree this change is a good idea.
Comment #7
adamps commented