From 73913afa1f77ab0fecd4b07d4d82c648d56b9634 Mon Sep 17 00:00:00 2001 From: Tom Stovall Date: Mon, 27 Jan 2025 10:42:20 -0800 Subject: [PATCH] restoring get Adapter --- src/Services/PantheonGuzzle.php | 17 +++++++++++++++-- src/Services/SolariumClient.php | 7 +------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/Services/PantheonGuzzle.php b/src/Services/PantheonGuzzle.php index 520993d..50c5ba5 100644 --- a/src/Services/PantheonGuzzle.php +++ b/src/Services/PantheonGuzzle.php @@ -26,8 +26,7 @@ */ class PantheonGuzzle extends Client implements ClientInterface, - LoggerAwareInterface, - AdapterInterface { + LoggerAwareInterface { use LoggerAwareTrait; use EndpointAwareTrait; @@ -167,4 +166,18 @@ public function requestUriAlterForPantheonEnvironment(RequestInterface $request) return $request->withUri($uri); } + /** + * Get a PSR adapter interface based on this class. + * + * @return \Solarium\Core\Client\Adapter\AdapterInterface + * The interface in question. + */ + public function getAdapter(): AdapterInterface { + return new Psr18Adapter( + $this, + new RequestFactory(), + new StreamFactory() + ); + } + } diff --git a/src/Services/SolariumClient.php b/src/Services/SolariumClient.php index 32fab2a..d411261 100644 --- a/src/Services/SolariumClient.php +++ b/src/Services/SolariumClient.php @@ -28,13 +28,8 @@ public function __construct( EventDispatcherInterface $event_dispatcher) { $drupal_major_parts = explode('.', \Drupal::VERSION); $drupal_major = reset($drupal_major_parts); - $psr18 = new Psr18Adapter( - $guzzle, - new RequestFactory(), - new StreamFactory(), - ); parent::__construct( - $psr18, + $psr18->getAdapter(), $event_dispatcher, ['endpoint' => [$endpoint]], );