Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[generate:module] with dependencies, Error: Call to undefined method Drupal\Console\Utils\Validator::trans() #3320

Closed
pslcbs opened this issue May 25, 2017 · 12 comments
Assignees
Labels

Comments

@pslcbs
Copy link

pslcbs commented May 25, 2017

  • Drupal console 1.0.0-rc19
  • Drupal 8.3.2 - English (default) and Spanish
  • Command generate:module

Error message

PHP Fatal error: Call to undefined method Drupal\Console\Utils\Validator::trans() in /home/user/public_html/site/vendor/drupal/console/src/Utils/Validator.php on line 280

How to reproduce

I get that error only when:

  • generate:module
  • answer 'yes' when asked if you want to set dependencies
  • in next step write dependee module name (e.g. pathauto)

Commenting the line where trans() method is called the command [generate:module] with dependencies is working again.

Thanks

@jmolivas
Copy link
Member

@pslcbs Can you try updating to latest RC20 and validate is this still happening.

Make sure you update Launcher and Site installation.

@pslcbs
Copy link
Author

pslcbs commented May 26, 2017

Hi @jmolivas,
Tried & worked ok with no errors
Thanks! ;-)

@jmolivas
Copy link
Member

Closing this one. Feel free to re-open if still happening after updating to the latest version.

@nvaken
Copy link
Contributor

nvaken commented May 31, 2017

I'm still experiencing this issue after updating to RC20.

$ drupal --version
Drupal Console Launcher version 1.0.0-rc20
Drupal Console version 1.0.0-rc20

Edit: FWIW I also rebuilt my cache (drupal cr all) after updating.

@jmolivas jmolivas reopened this May 31, 2017
@jmolivas
Copy link
Member

jmolivas commented May 31, 2017

@nvaken I saw the issue the problems is at https://github.com/hechoendrupal/drupal-console/blob/master/src/Utils/Validator.php#L280

We are trying to use $this->trans which does not exists

This could be fixed by:

@jmolivas jmolivas added the bug label May 31, 2017
jmolivas added a commit to jmolivas/drupal-console that referenced this issue Jun 7, 2017
@jmolivas jmolivas self-assigned this Jun 7, 2017
@jmolivas
Copy link
Member

jmolivas commented Jun 7, 2017

Fixed with #3334

@colans
Copy link

colans commented Jun 13, 2017

Still getting this with the latest releases:

colan@snake[Tue 13 16:52]% sudo drupal self-update                                                                                               
Checking for updates from version: "1.0.0-rc20"
Updated from version "1.0.0-rc20" to version "1.0.0-rc21".

If you want to update the DrupalConsole dependency
in your current site: /path/to/drupal
Execute: composer update drupal/console --with-dependencies
colan@snake[Tue 13 16:53]% composer update drupal/console --with-dependencies                                                                    
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess
> Drupal\Core\Composer\Composer::configurePhpcs

Backtrace:

Error: Call to undefined method Drupal\Console\Utils\Validator::trans() in /path/to/drupal/vendor/drupal/console/src/Utils/Validator.php on line 280 #0 /path/to/drupal/vendor/drupal/console/src/Command/Generate/ModuleCommand.php(197): Drupal\Console\Utils\Validator->validateExtensions('externalauth', 'module', Object(Drupal\Console\Core\Style\DrupalStyle))
#1 /path/to/drupal/vendor/symfony/console/Command/Command.php(264): Drupal\Console\Command\Generate\ModuleCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 /path/to/drupal/vendor/symfony/console/Application.php(868): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /path/to/drupal/vendor/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCommand(Object(Drupal\Console\Command\Generate\ModuleCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /path/to/drupal/vendor/drupal/console-core/src/Application.php(116): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /path/to/drupal/vendor/drupal/console/src/Application.php(49): Drupal\Console\Core\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /path/to/drupal/vendor/symfony/console/Application.php(123): Drupal\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /path/to/drupal/vendor/drupal/console/bin/drupal.php(68): Symfony\Component\Console\Application->run()
#8 phar:///usr/local/bin/drupal/src/Utils/Launcher.php(30): include_once('/path/to/dru...')
#9 phar:///usr/local/bin/drupal/bin/drupal.php(71): Drupal\Console\Launcher\Utils\Launcher->launch(Object(DrupalFinder\DrupalFinder))
#10 phar:///usr/local/bin/drupal/bin/drupal(3): require('phar:///usr/loc...')
#11 /usr/local/bin/drupal(10): require('phar:///usr/loc...')
#12 {main}
Error: Call to undefined method Drupal\Console\Utils\Validator::trans() in Drupal\Console\Utils\Validator->validateExtensions() (line 280 of /path/to/drupal/vendor/drupal/console/src/Utils/Validator.php).

@jmolivas
Copy link
Member

@colans what is your site DrupalConsole version ?

@colans
Copy link

colans commented Jul 6, 2017

@jmolivas I believe I was using the latest. Sorry, but I don't have it installed anymore, and worked around this by adding the dependency manually (skipping that step when running the command).

@jmolivas
Copy link
Member

jmolivas commented Jul 6, 2017

@colans is working now?

@colans
Copy link

colans commented Jul 6, 2017

No idea as I just used the workaround.

@jmolivas
Copy link
Member

jmolivas commented Jul 6, 2017

got it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants