Undeclared dependency

Created on 10 July 2023, about 1 year ago
Updated 12 July 2023, about 1 year ago

Problem/Motivation

I installed 3.1.0 on a non-Opigno D10 site and got this:

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "opigno_statistics.user_stats_manager". in Drupal\Component\DependencyInjection\Container->get() (line 157 of core/lib/Drupal/Component/DependencyInjection/Container.php).

Steps to reproduce

Install on a non-Opigno site.

Proposed resolution

The exception starts on this line in artistotle.theme:
$stats_service = \Drupal::service('opigno_statistics.user_stats_manager');

You could either use hasService first to make sure the service exists, or declare the opigno module that has that service as a dependency.

The same aristotle_preprocess_user function that has the problem also calls UserStatisticsManager::getDefaultUserPicture without checking if that class exists.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

3.1

Component

Code

Created by

🇺🇸United States TolstoyDotCom L.A.

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

Comments & Activities

Production build 0.71.5 2024