$ ./vendor/bin/drush solr-gsc solr_search_server conf.zip $SOLR_VERSION

 [error] TypeError: Argument 3 passed to Drupal\search_api\Utility\CommandHelper::__construct() must implement interface Symfony\Component\EventDispatcher\EventDispatcherInterface, string given, called in /home/travis/build/mkalkbrenner/drupal/modules/contrib/search_api/src/Commands/SearchApiCommands.php on line 34 in Drupal\search_api\Utility\CommandHelper->__construct() (line 88 of /home/travis/build/mkalkbrenner/drupal/modules/contrib/search_api/src/Utility/CommandHelper.php) #0 /home/travis/build/mkalkbrenner/drupal/modules/contrib/search_api/src/Commands/SearchApiCommands.php(34): Drupal\search_api\Utility\CommandHelper->__construct(Object(Drupal\Core\Entity\EntityTypeManager), Object(Drupal\Core\Extension\ModuleHandler), 'dt')
#1 /home/travis/build/mkalkbrenner/drupal/core/lib/Drupal/Component/DependencyInjection/Container.php(273): Drupal\search_api\Commands\SearchApiCommands->__construct(Object(Drupal\Core\Entity\EntityTypeManager), Object(Drupal\Core\Extension\ModuleHandler))
#2 /home/travis/build/mkalkbrenner/drupal/core/lib/Drupal/Component/DependencyInjection/Container.php(173): Drupal\Component\DependencyInjection\Container->createService(Array, 'search_api.comm...')
#3 /home/travis/build/mkalkbrenner/drupal/core/lib/Drupal/Component/DependencyInjection/Container.php(487): Drupal\Component\DependencyInjection\Container->get('search_api.comm...', 1)
#4 /home/travis/build/mkalkbrenner/drupal/core/lib/Drupal/Component/DependencyInjection/Container.php(326): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#5 /home/travis/build/mkalkbrenner/drupal/core/lib/Drupal/Component/DependencyInjection/Container.php(173): Drupal\Component\DependencyInjection\Container->createService(Array, 'drush.command.s...')
#6 /home/travis/build/mkalkbrenner/drupal/vendor/drush/drush/src/Boot/DrupalBoot8.php(277): Drupal\Component\DependencyInjection\Container->get('drush.command.s...')
#7 /home/travis/build/mkalkbrenner/drupal/vendor/drush/drush/src/Boot/DrupalBoot8.php(243): Drush\Boot\DrupalBoot8->addDrupalModuleDrushCommands(Object(Drush\Boot\BootstrapManager))
#8 /home/travis/build/mkalkbrenner/drupal/vendor/drush/drush/src/Boot/BootstrapManager.php(293): Drush\Boot\DrupalBoot8->bootstrapDrupalFull(Object(Drush\Boot\BootstrapManager), NULL)
#9 /home/travis/build/mkalkbrenner/drupal/vendor/drush/drush/src/Boot/BootstrapManager.php(493): Drush\Boot\BootstrapManager->doBootstrap(5, 6, NULL)
#10 /home/travis/build/mkalkbrenner/drupal/vendor/drush/drush/src/Application.php(225): Drush\Boot\BootstrapManager->bootstrapMax()
#11 /home/travis/build/mkalkbrenner/drupal/vendor/drush/drush/src/Application.php(192): Drush\Application->bootstrapAndFind('solr-gsc')
#12 /home/travis/build/mkalkbrenner/drupal/vendor/symfony/console/Application.php(236): Drush\Application->find('solr-gsc')
#13 /home/travis/build/mkalkbrenner/drupal/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /home/travis/build/mkalkbrenner/drupal/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /home/travis/build/mkalkbrenner/drupal/vendor/drush/drush/src/Runtime/Runtime.php(49): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /home/travis/build/mkalkbrenner/drupal/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#17 /home/travis/build/mkalkbrenner/drupal/vendor/drush/drush/drush(4): require('/home/travis/bu...')
#18 {main}. 
TypeError: Argument 3 passed to Drupal\search_api\Utility\CommandHelper::__construct() must implement interface Symfony\Component\EventDispatcher\EventDispatcherInterface, string given, called in /home/travis/build/mkalkbrenner/drupal/modules/contrib/search_api/src/Commands/SearchApiCommands.php on line 34 in Drupal\search_api\Utility\CommandHelper->__construct() (line 88 of /home/travis/build/mkalkbrenner/drupal/modules/contrib/search_api/src/Utility/CommandHelper.php).

Caused by the commit of #3023704: Convert hooks to events To search_api.

CommentFileSizeAuthor
#6 3065359.patch1.87 KBmkalkbrenner
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mkalkbrenner created an issue. See original summary.

mkalkbrenner’s picture

mkalkbrenner’s picture

Title: TypeError: Argument 3 passed to Drupal\search_api\Utility\CommandHelper::__construct() » Search API Solr config generation entirely broken
Project: Search API Solr » Search API
Version: 8.x-3.x-dev » 8.x-1.x-dev
Component: Code » General code
Issue summary: View changes
mkalkbrenner’s picture

I moved the issue to Search API for awareness and since there's no search_api_solr code involved in the stack trace.

mkalkbrenner’s picture

Title: Search API Solr config generation entirely broken » Drush commands entirely broken

Yes, here's the cause:

/**
 * Defines Drush commands for the Search API.
 */
class SearchApiCommands extends DrushCommands {

  /**
   * Constructs a SearchApiCommands object.
   *
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
   *   The entity type manager.
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
   *   The module handler.
   */
  public function __construct(EntityTypeManagerInterface $entityTypeManager, ModuleHandlerInterface $moduleHandler) {
    $this->commandHelper = new CommandHelper($entityTypeManager, $moduleHandler, 'dt');
  }

...

The third parameter of CommandHelper::_construct() changed.

mkalkbrenner’s picture

Status: Active » Needs review
FileSize
1.87 KB
borisson_’s picture

Status: Needs review » Reviewed & tested by the community

This is a simple fix, but I'm not sure how this got in. We should try to find a way to also test this on the d.o infra I guess.

waverate’s picture

@mkalkbrenner. Thank you for the fix. Works great.

drunken monkey’s picture

Component: General code » Drush / Rules
Status: Reviewed & tested by the community » Fixed

Thanks a lot for finding and fixing this, Markus!
Cleaned up the code a bit and committed.
Thanks a lot again!

Yeah, I don’t really use Drush for Search API stuff, so it’s possible that even such critical bugs in the Drush integration can slip in. Also, I’m not aware of any way to test the Drush integration using d.o’s CI tools. We do test the CommandHelper class, which should cover most problems – but, as we see here, the tiny bit that does remain in the Drush-specific class can’t easily be covered and remains a risk.

Status: Fixed » Closed (fixed)

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

blake.thompson’s picture

If people happen upon this issue, this can break Search API Solr's use with Drush due to it extending the CommandHelper class, depending on which versions you have installed.