Skip to content

Commit

Permalink
Fixing issues with Event Dispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
stovak committed Jan 22, 2025
1 parent 5cb267e commit 1a3ab7a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"guzzlehttp/guzzle": "^7.5",
"guzzlehttp/psr7": "^2.7",
"kint-php/kint": "^5|^6",
"php-http/guzzle7-adapter": "^1.1",
"psr/event-dispatcher": "^1.0",
"symfony/finder": "^4.4|^5|^6|^7",
"symfony/yaml": "^4.4|^5|^6|^7"
Expand Down
1 change: 0 additions & 1 deletion src/Commands/Reload.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Drupal\search_api_pantheon\Commands;

use Drupal\Core\Logger\LoggerChannelTrait;
use Drupal\search_api_pantheon\Services\PantheonGuzzle;
use Drupal\search_api_pantheon\Services\SchemaPoster;
use Drush\Commands\DrushCommands;
Expand Down
1 change: 0 additions & 1 deletion src/Commands/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Drupal\search_api_pantheon\Commands;

use Drupal\Core\Logger\LoggerChannelTrait;
use Drupal\search_api_pantheon\Plugin\SolrConnector\PantheonSolrConnector;
use Drupal\search_api_pantheon\Services\PantheonGuzzle;
use Drupal\search_api_pantheon\Services\SchemaPoster;
Expand Down
13 changes: 13 additions & 0 deletions src/Services/PantheonGuzzle.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
use Solarium\Core\Client\Adapter\AdapterInterface;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\Session\AccountProxyInterface;
use Solarium\Core\Client\Endpoint;
use Solarium\Core\Client\Request;
use Solarium\Core\Client\Response;

/**
* Pantheon-specific extension of the Guzzle http query class.
Expand Down Expand Up @@ -160,4 +163,14 @@ public function requestUriAlterForPantheonEnvironment(RequestInterface $request)
return $request->withUri($uri);
}

/**
* Execute a query.
*/
public function execute(Request $request, Endpoint $endpoint): Response {
if ($endpoint instanceof Endpoint) {
$this->setEndpoint($endpoint);
}
return $this->sendRequest($request);
}

}
8 changes: 6 additions & 2 deletions src/Services/SolariumClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Solarium\Core\Query\Result\ResultInterface;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\search_api_pantheon\Solarium\EventDispatcher\Psr14Bridge;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
* Customized Solrium Client to send Guzzle debugging to log entries.
Expand All @@ -21,7 +21,11 @@ class SolariumClient extends Client {
/**
* Class constructor.
*/
public function __construct(PantheonGuzzle $guzzle, Endpoint $endpoint, LoggerChannelFactoryInterface $logger_factory, EventDispatcher $event_dispatcher) {
public function __construct(
PantheonGuzzle $guzzle,
Endpoint $endpoint,
LoggerChannelFactoryInterface $logger_factory,
EventDispatcherInterface $event_dispatcher) {
$drupal_major_parts = explode('.', \Drupal::VERSION);
$drupal_major = reset($drupal_major_parts);
if ($drupal_major < 9) {
Expand Down

0 comments on commit 1a3ab7a

Please sign in to comment.