Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Saphyel created an issue. See original summary.

Saphyel’s picture

Assigned: Saphyel » Unassigned
Status: Needs work » Needs review
FileSize
15.87 KB

This patch can also be found here: https://github.com/damienmckenna/metatag/pull/3

I didn't delete the translation because when the commands are back we don't need to revert that change

Status: Needs review » Needs work

The last submitted patch, 2: 2752239-2_remove_commands.patch, failed testing.

DamienMcKenna’s picture

Status: Needs work » Closed (cannot reproduce)

I'm not willing to remove the commands, I just ran one a moment ago and was able to generate a new tag plugin.

If you can show a scenario where the commands don't work with the latest version of Drupal Console and the latest stable release of Drupal core then we can try to identify the problem, but without further evidence this appears to be a-ok.

Saphyel’s picture

FileSize
107.85 KB

It doesn't matter which command you execute it's just breaking all commands.
I'm using master branch of Console because I'm helping to contribute and for me is easy to test in that way. The drupal release is not really relevant... and the problems as I said in #1 is the commands, the module works fine.

I uploaded a picture in case you don't believe me, it's fine, but yeah it happens.

The update in commands is gonna be stable sooner or later so Metatags will have to face it, someone else is going to report this again soon...

Also the title of the issue is pretty clear, it doesn't mean the functionality of the module fails or the commands are wrong

dazz’s picture

Status: Closed (cannot reproduce) » Active

I have the same issue with console version 1.0.0-beta3.

Saphyel’s picture

Assigned: Unassigned » Saphyel
Status: Active » Needs work

I have updated the commands to make it works with the new format, I'll upload the patch soon.

Saphyel’s picture

Status: Needs work » Needs review
FileSize
20.39 KB
Saphyel’s picture

Assigned: Saphyel » Unassigned

Status: Needs review » Needs work

The last submitted patch, 8: update_console_commands-2752239-8.patch, failed testing.

Saphyel’s picture

Status: Needs work » Needs review
FileSize
11.01 KB

Sorry wrong patch :(

sylus’s picture

I too saw this issue with latest docker console, the patch however was still giving me errors related to:

Error: Class 'Drupal\metatag\Command\InputOption' not found in /data/var/www/drupal/profiles/wxt/modules/contrib/metatag/src/Command/GenerateGroupCommand.php on line 29
Error: Class 'Drupal\metatag\Command\InputOption' not found in Drupal\metatag\Command\GenerateGroupCommand->configure() (line 29 of /data/var/www/drupal/profiles/wxt/modules/contrib/metatag/src/Command/GenerateGroupCommand.php).

I added back that use statement and resolved that error except then I ran: generate:metatag:group and got:

Error: Call to undefined method Drupal\metatag\Command\GenerateGroupCommand::moduleQuestion() in /data/var/www/drupal/profiles/wxt/modules/contrib/metatag/src/Command/GenerateGroupCommand.php on line 87
Error: Call to undefined method Drupal\metatag\Command\GenerateGroupCommand::moduleQuestion() in Drupal\metatag\Command\GenerateGroupCommand->interact() (line 87 of /data/var/www/drupal/profiles/wxt/modules/contrib/metatag/src/Command/GenerateGroupCommand.php).

Rather then the larger change of using the ContainerAwareCommandTrait and the removal of several functions including the confirmation form I just adjusted the libraries to point to their new Shared folder they were moved to and issues got resolved. I kept the translations adjustments and the docblock header removal for files ending in *.php.

For the simple trait namespacing and rename to Shared folder see: https://github.com/hechoendrupal/DrupalConsole/issues/2148

dazz’s picture

#12 worked for me

DamienMcKenna’s picture

laVera’s picture

#12 still working. Thanks! to the maintainer: this is a big conflict, please mind it ;)

bdlangton’s picture

I can verify that #12 works for me.

albertski’s picture

#12 works for me.

jamiehollern’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #12 works for me.

DamienMcKenna’s picture

I reinstalled 0.11.2 and I now see the following when I run a DrupalConsole command:

Fatal error: Trait 'Drupal\Console\Command\ServicesTrait' not found in /Users/dmckenna/Sites/drupal/8/modules/contrib/metatag/src/Command/GenerateGroupCommand.php on line 24

sylus’s picture

I believe 0.11.2 will work with the old metatag code not requiring this patch as they didn't refactor and move to the Shared folder yet.

The issue got committed on June 3rd, so just after they released v1.0.0-beta2. So this patch would be needed for anything using v1.0.0-beta3+.

https://github.com/hechoendrupal/DrupalConsole/issues/2148

DamienMcKenna’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
5.96 KB

Rerolled.

DamienMcKenna’s picture

Some changes accidentally snook into #2745177: Write tests to ensure all submodules can be enabled & all meta tags are usable:

diff --git a/src/Command/GenerateGroupCommand.php b/src/Command/GenerateGroupCommand.php
index a9aaf6f..fe8e175 100644
--- a/src/Command/GenerateGroupCommand.php
+++ b/src/Command/GenerateGroupCommand.php
@@ -6,10 +6,6 @@
 use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 use Drupal\Console\Command\GeneratorCommand;
-use Drupal\Console\Command\ServicesTrait;
-use Drupal\Console\Command\ModuleTrait;
-use Drupal\Console\Command\FormTrait;
-use Drupal\Console\Command\ConfirmationTrait;
 use Drupal\Console\Style\DrupalStyle;
 use Drupal\metatag\Generator\MetatagGroupGenerator;
 
@@ -21,10 +17,6 @@
  * @package Drupal\metatag
  */
 class GenerateGroupCommand extends GeneratorCommand {
-  use ServicesTrait;
-  use ModuleTrait;
-  use FormTrait;
-  use ConfirmationTrait;
 
   /**
    * {@inheritdoc}
@@ -56,7 +48,6 @@ protected function configure() {
   protected function execute(InputInterface $input, OutputInterface $output) {
     $io = new DrupalStyle($input, $output);
 
-    // @see use Drupal\Console\Command\ConfirmationTrait::confirmGeneration
     if (!$this->confirmGeneration($io)) {
       return 1;
     }
@@ -94,7 +85,6 @@ protected function interact(InputInterface $input, OutputInterface $output) {
     // --module option.
     $module = $input->getOption('module');
     if (empty($module)) {
-      // @see Drupal\AppConsole\Command\Helper\ModuleTrait::moduleQuestion
       $module = $this->moduleQuestion($output);
     }
     $input->setOption('module', $module);
diff --git a/src/Command/GenerateTagCommand.php b/src/Command/GenerateTagCommand.php
index 5f60b92..eac8203 100644
--- a/src/Command/GenerateTagCommand.php
+++ b/src/Command/GenerateTagCommand.php
@@ -6,10 +6,6 @@
 use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 use Drupal\Console\Command\GeneratorCommand;
-use Drupal\Console\Command\ServicesTrait;
-use Drupal\Console\Command\ModuleTrait;
-use Drupal\Console\Command\FormTrait;
-use Drupal\Console\Command\ConfirmationTrait;
 use Drupal\Console\Style\DrupalStyle;
 use Drupal\metatag\Generator\MetatagTagGenerator;
 
@@ -21,10 +17,6 @@
  * @package Drupal\metatag
  */
 class GenerateTagCommand extends GeneratorCommand {
-  use ServicesTrait;
-  use ModuleTrait;
-  use FormTrait;
-  use ConfirmationTrait;
 
   /**
    * {@inheritdoc}
@@ -76,7 +68,6 @@ protected function configure() {
   protected function execute(InputInterface $input, OutputInterface $output) {
     $io = new DrupalStyle($input, $output);
 
-    // @see use Drupal\Console\Command\ConfirmationTrait::confirmGeneration
     if (!$this->confirmGeneration($io)) {
       return 1;
     }
@@ -94,9 +85,6 @@ protected function execute(InputInterface $input, OutputInterface $output) {
     $secure = $input->getOption('secure');
     $multiple = $input->getOption('multiple');
 
-    // @see use Drupal\Console\Command\ServicesTrait::buildServices
-    // $build_services = $this->buildServices($services);
-
     $this
       ->getGenerator()
       ->generate($base_class, $module, $name, $label, $description, $plugin_id, $class_name, $group, $weight, $type, $secure, $multiple);
@@ -136,7 +124,6 @@ protected function interact(InputInterface $input, OutputInterface $output) {
     // --module option.
     $module = $input->getOption('module');
     if (empty($module)) {
-      // @see Drupal\AppConsole\Command\Helper\ModuleTrait::moduleQuestion
       $module = $this->moduleQuestion($output);
     }
     $input->setOption('module', $module);
DamienMcKenna’s picture

Status: Needs review » Needs work

Needs work:

$ drupal generate:metatag:tag --module='metatag_open_graph' --name='og:image:widthx' --label="Image width" --description="The height of the above image(s). Note: if both the unsecured and secured images are provided, they should both be the same size." --plugin-id='og_image_widthx' --class-name='OgImageWidthX' --group='open_graph' --weight=0 --type=label --multiple=FALSE --base_class='MetaNameBase' --secure=0 -y

Fatal error: Call to undefined method Drupal\metatag\Command\GenerateTagCommand::confirmGeneration() in /Users/dmckenna/Sites/drupal/8/modules/contrib/metatag/src/Command/GenerateTagCommand.php on line 71
DamienMcKenna’s picture

Title: Update console commands » Fix console commands
dman’s picture

Just a hint for others today:
As I'm not keen on patching into part of a composer-built drupal-project the team is working on this week, given that it looks like a working fix is not far off,
I found that rolling drupal/console back to 1.0.0-beta2 made the site usable again for now.

(I've got to lock drupal/console at 1.0.0-beta3 or lower anyway, due to them now requiring a higher PHP version than the deployment target server can use)

sylus’s picture

Status: Needs work » Needs review
FileSize
8.87 KB

I just brought back the traits and everything worked with the open graph example above for drupal console 1.0.0-beta3+ (tested against 1.0.0-beta4).

DamienMcKenna’s picture

Status: Needs review » Fixed
Parent issue: » #2741339: Plan for Metatag 8.x-1.0-beta10 release

Committed. Thanks.

OnkelTem’s picture

The Fatal error still occurs on Drupal Console 0.11.3.

sylus’s picture

Please read #2752239-21: Fix console commands 0.11.3 wont work with newer code, please use newer then beta3

-enzo-’s picture

I did small changes to be able to work with the latest version of Drupal Console beta5 and be prepared to work with RC1+; commands will be services

-enzo-’s picture

Status: Fixed » Needs review
-enzo-’s picture

Removed commented code

heddn’s picture

I've listed this as a dependency in #2741339: Plan for Metatag 8.x-1.0-beta10 release.

DamienMcKenna’s picture

@heddn: It's already listed here as the "parent" issue, i.e. that hopefully it'll be fixed for beta10.

Could everyone please test out -enzo-'s patch and let me know if it works? Thanks.

  • DamienMcKenna committed 869986c on 8.x-1.x authored by -enzo-
    Issue #2752239 by DamienMcKenna: Fixes to Drupal:Console integration.
    
DamienMcKenna’s picture

Status: Needs review » Fixed

Committed.

giuliovale’s picture

Hi,
with this commit I have:
PHP Fatal error: Class 'Drupal\Console\Command\GeneratorCommand' not found in /var/www/drupal8/modules/metatag/src/Command/GenerateGroupCommand.php on line 27
Drush command terminated abnormally due to an unrecoverable error.
Error: Class 'Drupal\Console\Command\GeneratorCommand' not found in
/var/www/drupal8/modules/metatag/src/Command/GenerateGroupCommand.php,line 27

for every drush command

DamienMcKenna’s picture

@giuliovale: Sorry about that :( I've opened #2786795: DrupalConsole integration breaks Drush and an issue on github to work on this.

mark.labrecque’s picture

Thanks for all the efforts on getting this looked at guys. I needed to get this fixed and didn't require the integration, so I was able to just create a simple patch to remove the console integration. Thought I would provide this in case anyone else is in the same situation.

... Just until we can fix the actual problem of course :)

-enzo-’s picture

@mark.labrecque

Maybe I am wrong, but I guess did you upload the wrong patch

DamienMcKenna’s picture

@mark.labrecque: The patch doesn't remove anything, it adds two files and adds the new services to the metatag.services.yml file.

Lets keep the "fix Drush / DrupalConsole" stuff to #2786795: DrupalConsole integration breaks Drush.

mark.labrecque’s picture

@DamienMcKenna yeah, I just realized that I actually patched it backwards... :( I will post my corrected patch to the other issue.

Status: Fixed » Closed (fixed)

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