Error when loading CmisRepositoryController

Created on 8 March 2024, over 1 year ago

Problem/Motivation

On Drupal 10 (with the patch from 📌 Automated Drupal 10 compatibility fixes Needs review for now), we get this error when browsing to :

Cannot autowire service "": argument "$config" of method "Drupal\cmis\Controller\CmisRepositoryController::_construct()", you should configure its value explicitly.

This seems to happen because CmisRepositoryController::_construct() has arguments but controller constructor arguments are used for dependency injection so Drupal tries to guess what services need to be passed to the constructor.

It seems weird that the CmisRepositoryController is used both as a controller class for routing and more like a service in some parts of the code like CmisFieldBrowserBuilder::build():

    $browser = new CmisRepositoryController($config_id, $folder_id, ['show_breadcrumb' => $show_breadcrumb]);

    return $browser->browse($config_id, $folder_id);

Steps to reproduce

Browse to /cmis/browser/foo.

Proposed resolution

The constructor should be reserved for dependency injection and what it currently does should be moved to a new method (CmisRepositoryController::fromConfig() for example).

🐛 Bug report
Status

Needs review

Component

Code

Created by

🇫🇷France prudloff Lille

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024