Problem/Motivation

Currently, the module is not usable in Drupal 9. Due to changes in autowiring logic in Symfony 4, you'll get a runtime exception when you try to install the module or try to upgrade to Drupal 9. This is a stack trace from an attempted update from latest stable 8.9 to current stable 9.1 release with the latest version of the module installed:

Symfony\Component\DependencyInjection\Exception\RuntimeException: Cannot autowire service "last_tweets.service.last_tweets_manager": argument "$config" of method "Drupal\last_tweets\Service\LastTweetsManager::__construct()" references class "Drupal\Core\Config\ConfigFactory" but no such service exists. You should maybe alias this class to the existing "config.factory" service. in vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php on line 54
#0 vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php(82): Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass->processValue(Object(Symfony\Component\DependencyInjection\Definition), true)
#1 vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php(32): Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->processValue(Array, true)
#2 vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php(46): Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass->processValue(Array, true)
#3 vendor/symfony/dependency-injection/Compiler/Compiler.php(94): Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->process(Object(Drupal\Core\DependencyInjection\ContainerBuilder))
#4 vendor/symfony/dependency-injection/ContainerBuilder.php(762): Symfony\Component\DependencyInjection\Compiler\Compiler->compile(Object(Drupal\Core\DependencyInjection\ContainerBuilder))
#5 core/lib/Drupal/Core/DrupalKernel.php(1293): Symfony\Component\DependencyInjection\ContainerBuilder->compile()
#6 core/lib/Drupal/Core/DrupalKernel.php(898): Drupal\Core\DrupalKernel->compileContainer()
#7 core/lib/Drupal/Core/Update/UpdateKernel.php(41): Drupal\Core\DrupalKernel->initializeContainer()
#8 core/lib/Drupal/Core/DrupalKernel.php(471): Drupal\Core\Update\UpdateKernel->initializeContainer()
#9 core/lib/Drupal/Core/Update/UpdateKernel.php(64): Drupal\Core\DrupalKernel->boot()
#10 update.php(27): Drupal\Core\Update\UpdateKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#11 {main}

Note, that you'll get similar exceptions for all arguments of the LastTweetsManager contructor, once you resolve them one by one.

Steps to reproduce

Install the module in Drupal 9.1.4 and try to clear caches/rebuild the container or attempt an update from 8.9.13 to 9.1.4 and try to run update.php.

Proposed resolution

Either don't rely on autowiring and use arguments instead or set up aliases as suggested by the runtime exception.

CommentFileSizeAuthor
#2 3200052-02.patch711 bytesfeyp

Comments

FeyP created an issue. See original summary.

feyp’s picture

Status: Active » Needs review
StatusFileSize
new711 bytes

Attached is a patch against 8.x-2.x that should fix the issue. Note that I didn't test on Drupal 8, but I don't see why it shouldn't work there.

feyp’s picture

Assigned: feyp » Unassigned
sgostanyan’s picture

Fixed in release 2.9

sgostanyan’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.