Following error thrown when updating to 8.1.0-beta10 and trying to run "drush updb".

PHP Fatal error: Trait 'Drupal\Console\Command\Shared\ContainerAwareCommandTrait' not found in /wwwroot/web/modules/contrib/metatag/src/Command/GenerateGroupCommand.php on line 29

Comments

heikki created an issue. See original summary.

dietr_ch’s picture

A similar error occurs while enabling the module:

PHP Fatal error: Class 'Drupal\Console\Command\GeneratorCommand' not found in /var/www/drupalvm/modules/composer/metatag/src/Command/GenerateGroupCommand.php on line 27

damienmckenna’s picture

I've opened an issue for Drush asking about this and asked DrupalConsole too. I'll try to get to the bottom of this.

fomenkoandrey’s picture

the same error on beta10

[23-Aug-2016 12:31:58 Europe/Helsinki] PHP Fatal error: Class 'Drupal\Console\Command\GeneratorCommand' not found in /home/motokal1/public_html/modules/metatag/src/Command/GenerateGroupCommand.php on line 27

damienmckenna’s picture

Status: Needs review » Active

BTW you should set the issue status to "active" when you create a new issue, "needs review" is for when there's a patch that needs to be reviewed.

agoradesign’s picture

Normally, this could be solved by including Drupal Console in the project's composer.json (or better: in metatag's module composer.json, if there's a requirement for having Drupal Console)

However, if I'm adding it to my composer.json as required dependency to include the current version (1.0.0-beta5), I'm getting a different error on drush commands.

"drupal/console": "~1.0",

I needed to run "drush entup", but the command fails with this stacktrace:

TypeError: Argument 1 passed to Drupal\Console\Command\Command::__construct() must be an instance of Symfony\Component\Console\Helper\HelperSet, none given,   [error]
called in /var/www/drupalvm/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 264 in Drupal\Console\Command\Command->__construct() (line
35 of /var/www/drupalvm/vendor/drupal/console/src/Command/Command.php).
TypeError: Argument 1 passed to Drupal\Console\Command\Command::__construct() must be an instance of Symfony\Component\Console\Helper\HelperSet, none given, called in /var/www/drupalvm/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 264 in /var/www/drupalvm/vendor/drupal/console/src/Command/Command.php on line 35
TypeError: Argument 1 passed to Drupal\Console\Command\Command::__construct() must be an instance of Symfony\Component\Console\Helper\HelperSet, none given, called in /var/www/drupalvm/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 264 in Drupal\Console\Command\Command->__construct() (line 35 of /var/www/drupalvm/vendor/drupal/console/src/Command/Command.php).
damienmckenna’s picture

The thing is, it isn't a requirement, it's optional.

agoradesign’s picture

The other thing is the error above, when using Drupal Console. Do you have an idea, where they come from? Which version have you used during developing the commands?

damienmckenna’s picture

$ drupal self-update
 Checking for updates from version: "1.0.0-beta5"
 The latest version "1.0.0-beta5", was already installed on your system.
agoradesign’s picture

thx. After playing around a bit, it seems more likely that Drush is interfering here, as issuing a Metatag specific DrupalConsole command works for me without errors, e.g. drupal generate:metatag:tag

agoradesign’s picture

added #2786795: DrupalConsole integration breaks Drush as related issue. imho we should close one issue as duplicate, what do you mean?

agoradesign’s picture

I've attached a patch to temporarily deactivate the DrupalConsole services. Might be a great help for others being in the same situation like me in my current project, where I do not need the Console integration, but a working Drush CLI

damienmckenna’s picture

Status: Active » Closed (duplicate)

Yeah, lets close this as a duplicate of #2786795: DrupalConsole integration breaks Drush.