diff --git a/src/Client/RedmineClient.php b/src/Client/RedmineClient.php index 8b2c39f..879f0e2 100644 --- a/src/Client/RedmineClient.php +++ b/src/Client/RedmineClient.php @@ -6,7 +6,6 @@ use Redmine\Client\Psr18Client; use GuzzleHttp\Client as GuzzleClient; use GuzzleHttp\Psr7\HttpFactory as GuzzleHttpFactory; use Symfony\Contracts\Cache\TagAwareCacheInterface; -use Symfony\Component\DependencyInjection\Attribute\Autowire; final class RedmineClient { @@ -15,8 +14,7 @@ final class RedmineClient private ?string $apiKey = null; public function __construct( - #[Autowire(service: 'redmine_api_cache_pool')] - private TagAwareCacheInterface $redmineApiCachePool + private TagAwareCacheInterface $cache ) {} public function setUrl(string $url): self @@ -33,7 +31,7 @@ final class RedmineClient { $cacheKey = sprintf('%s_%s_%s', $api, $method, sha1(serialize($arguments))); - return $this->redmineApiCachePool->get($cacheKey, function (ItemInterface $item): string { + return $this->cache->get($cacheKey, function (ItemInterface $item): string { $item->expiresAfter(3600); $item->tag([$api, $method]); diff --git a/src/DependencyInjection/MagdevRedmineExtension.php b/src/DependencyInjection/MagdevRedmineExtension.php index ad20a36..a2bec8d 100644 --- a/src/DependencyInjection/MagdevRedmineExtension.php +++ b/src/DependencyInjection/MagdevRedmineExtension.php @@ -25,6 +25,7 @@ final class MagdevRedmineExtension extends Extension $container->register($id, RedmineClient::class) ->addMethodCall('setUrl', [$connection['url']]) ->addMethodCall('setApiKey', [$connection['apikey']]); + $container->registerAliasForArgument($id, RedmineClient::class, "{$name}Client"); if ($name === $config['default_connection']) {