Problem/Motivation

The problem is introduce in #3201043: Submodule sendgrid_integration_reports needs to be more flexible
which

use Drupal\Core\Logger\LoggerChannelFactory;

instead of

use Drupal\Core\Logger\LoggerChannelFactoryInterface;

It will cause issues when you are using other logger modules replacing core logger.

Steps to reproduce

Install / enable Monolog module or other another logger modules that will replace core logger with a different implementation.
try do anything (e.g. drush cr), you got errors like
Fatal error: Uncaught TypeError: Argument 3 passed to Drupal\sendgrid_integration_reports\Api::__construct() must be an instance of Drupal\Core\Logger\LoggerChannelFactory, instance of Drupal\monolog\Logger\MonologLoggerChannelFactory given, called in /var/www/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 257 and defined in /var/www/web/modules/contrib/sendgrid_integration/modules/sendgrid_integration_reports/src/Api.php:84

Proposed resolution

change all occurrences of LoggerChannelFactory to LoggerChannelFactoryInterface.

Remaining tasks

Patch.

User interface changes

API changes

Data model changes

Command icon 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

yang_yi_cn created an issue. See original summary.

yang_yi_cn’s picture

A similar error on the same file, actually.

Argument 5 passed to Drupal\sendgrid_integration_reports\Api::_  
  _construct() must be an instance of Drupal\Core\Cache\CacheFactory, instanc  
  e of Drupal\Core\Update\UpdateCacheBackendFactory given  

Fix is to change CacheFactory to CacheFactoryInterface.

Committed on the same branch / MR.

perignon’s picture

Status: Active » Fixed

Merged PR.

You may want to check out the 2.x Alpha.

Status: Fixed » Closed (fixed)

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

lambic’s picture

Can we get this same change merged to the 2.x branch?

perignon’s picture

I just cherry-picked the change into 8.x-2.x, give it a shot.

lambic’s picture

works, thanks!