From f2631788273fe0f44d3c5e67ed79599bc3658723 Mon Sep 17 00:00:00 2001 From: Rob Loach <robloach@gmail.com> Date: Wed, 4 Jan 2023 13:04:17 -0500 Subject: [PATCH] Issue #3320326 by cslevy: ArgumentCountError when trying to post schema --- search_api_pantheon.services.yml | 2 +- src/Services/SchemaPoster.php | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) mode change 100644 => 100755 search_api_pantheon.services.yml diff --git a/search_api_pantheon.services.yml b/search_api_pantheon.services.yml old mode 100644 new mode 100755 index dd187f45..34776a37 --- a/search_api_pantheon.services.yml +++ b/search_api_pantheon.services.yml @@ -1,7 +1,7 @@ services: search_api_pantheon.schema_poster: class: Drupal\search_api_pantheon\Services\SchemaPoster - arguments: ['@logger.factory', '@search_api_pantheon.pantheon_guzzle', '@entity_type.manager'] + arguments: ['@logger.factory', '@search_api_pantheon.pantheon_guzzle', '@entity_type.manager', '@extension.list.module'] search_api_pantheon.endpoint: class: Drupal\search_api_pantheon\Services\Endpoint arguments: [[], '@entity_type.manager'] diff --git a/src/Services/SchemaPoster.php b/src/Services/SchemaPoster.php index 7270bbe2..fac2c2f6 100644 --- a/src/Services/SchemaPoster.php +++ b/src/Services/SchemaPoster.php @@ -4,6 +4,7 @@ use Drupal\Component\FileSystem\FileSystem; use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Extension\ModuleExtensionList; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\search_api_solr\Controller\SolrConfigSetController; use GuzzleHttp\ClientInterface; @@ -50,17 +51,26 @@ class SchemaPoster implements LoggerAwareInterface { */ protected EntityTypeManagerInterface $entityTypeManager; + /** + * The module extension list. + * + * @var \Drupal\Core\Extension\ModuleExtensionList + */ + protected $moduleExtensionList; + /** * Class Constructor. */ public function __construct( LoggerChannelFactoryInterface $logger_factory, PantheonGuzzle $client, - EntityTypeManagerInterface $entity_type_manager + EntityTypeManagerInterface $entity_type_manager, + ModuleExtensionList $module_extension_list ) { $this->logger = $logger_factory->get('PantheonSearch'); $this->client = $client; $this->entityTypeManager = $entity_type_manager; + $this->moduleExtensionList = $module_extension_list; } /** @@ -242,7 +252,7 @@ public function getSolrFiles(string $server_id = 'pantheon_solr8') { 'cannot retrieve the solr server connection settings from the database' ); } - $solr_configset_controller = new SolrConfigSetController(); + $solr_configset_controller = new SolrConfigSetController($this->moduleExtensionList); $solr_configset_controller->setServer($server); return $solr_configset_controller->getConfigFiles();