Using the command drupal commerce:create:store gives this error:

Error: Call to undefined method Drupal\commerce_store\Command\CreateStoreCommand::isMaintenance() in /var/www/html/shopperce_profile/vendor/drupal/console-core/src/EventSubscriber/MaintenanceModeListener.
Error: Call to undefined method Drupal\commerce_store\Command\CreateStoreCommand::isMaintenance() in Drupal\Console\Core\EventSubscriber\MaintenanceModeListener->switchMaintenanceMode() (line 80 of /var/www/html/shopperce_profile/vendor/drupal/console-core/src/EventSubscriber/MaintenanceModeListener.php).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Yasser Samman created an issue. See original summary.

Yasser Samman’s picture

Using Drupal\Console\Core\Command\Command instead of Symfony\Component\Console\Command\Command Solves the issue.

Anas_maw’s picture

Status: Active » Needs review
Anas_maw’s picture

The last patch is needed after this pull request has been merged.

Yasser Samman’s picture

bojanz’s picture

Title: Call to undefined method isMaintenance() when using drupal console to create a store » The commerce:create:store command is broken for Drupal Console v1.9.0

Updating title.

Note that at some point we were told to extend the Symfony Console base class and to use the Drupal Console trait, now it seems that we should be extending the Drupal Console base class again? If so, we need to remove the trait usage.

It's not cool that Console is introducing breaking changes in minor releases.

Yasser Samman’s picture

You are right @bojanz, the trait usage is unnecessary when using the Drupal console base class. I've attached the correct patch.

Personally I think using the Drupal console base class is a better solution as it already uses the Symfony Console class.
Also, and excuse my ignorance regarding the matter, why not drush ?

bojanz’s picture

Also, and excuse my ignorance regarding the matter, why not drush ?

Drush got rewritten to use Symfony Console from version 9. Back when we started using Console (in 2016, I think), Drush still had a D7-like API, with a much worse developer experience.

I'd be fine with offering both Drush and Console commands.

  • bojanz committed 9e3651a on 8.x-2.x authored by Yasser Samman
    Issue #3065103 by Yasser Samman, bojanz: The commerce:create:store...
bojanz’s picture

Status: Needs review » Fixed

Tweaked the ordering of the use statements and committed, thanks!

Status: Fixed » Closed (fixed)

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