Problem/Motivation

After a fresh composer require 'drupal/symfony_mailer:^2.0@alpha', either via drush or UI, try to enable the module (will enable both symfony_mailer and mailer_transport), and will cause the following error:

Fatal error: Trait "Drupal\symfony_mailer\AutowireTrait" not found in /var/www/html/web/modules/contrib/symfony_mailer/modules/mailer_transport/src/Plugin/TransportUI/DsnTransportUI.php on line 22

Steps to reproduce

- Fresh install
- drush en mailer_transport / drush en symfony_mailer
- Also valid via UI

Proposed resolution

Move AutowireTrait into mailer_transport module.

Remaining tasks

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

gorkagr created an issue. See original summary.

gorkagr’s picture

Issue summary: View changes
adamps’s picture

Thanks. The problem is that mailer_tranport is using that class from symfony_mailer without declaring a dependency and also symfony_mailer depends on mailer_tranport.

This affects fresh installs only - I have various sites running with the current release. So 2 potential workarounds:

  1. upgrade from 1.x
  2. hack some files to allow install - might be enough just to comment out in two places in mailer_transport module use AutowireTrait; - then put back after installing

adamps’s picture

Status: Active » Needs review

It's strange that the tests still worked.

  • adamps committed 118afe79 on 2.x
    Issue #3527939 by adamps, gorkagr: PHP fatal error when trying to...
adamps’s picture

Issue summary: View changes
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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