Uncaught TypeError: Argument 1 RouteSubscriber::__construct() must implement interface EntityManagerInterface after upgrading from 8.x-1.0 to 8.x-3

Created on 28 June 2021, almost 4 years ago
Updated 1 June 2024, 11 months ago

Problem/Motivation

After updating from 8.x-1.0 to 8.x-3.1, I get this error when I try to clear caches with Drush.

PHP Fatal error: Uncaught TypeError: Argument 1 passed to Drupal\field_group\Routing\RouteSubscriber::__construct() must implement interface Drupal\Core\Entity\EntityManagerInterface, instance of Drupal\Core\Entity\EntityTypeManager given, called in web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 and defined in /web/modules/contribfield_group/src/Routing/RouteSubscriber.php:29

The service definition has the following arguments defined: "['@entity_type.manager']", but the constructor expects EntityManagerInterface:

  /**
   * Constructs a RouteSubscriber object.
   *
   * @param \Drupal\Core\Entity\EntityManagerInterface $manager
   *   The entity type manager.
   */
  public function __construct(EntityManagerInterface $manager) {
    $this->manager = $manager;
  }

Proposed resolution

There are 2 options. We can update field_group.services.yml to use "entity.manager" instead of "entity_type.manager", or we can update the class constructor to expect EntityTypeManagerInterface.

Any thoughts on which approach would be preferred?

πŸ› Bug report
Status

Closed: cannot reproduce

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States seismicmike

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024