From 28487d97a0da8c48279ebe3e75f0b747f2f7cedf Mon Sep 17 00:00:00 2001 From: Vlad Gorenkin Date: Mon, 15 Oct 2018 13:50:43 +0600 Subject: [PATCH] #30 Use container inside AwsSdks instead of locator --- src/AwsBundle/Client/AwsSdks.php | 12 ++++++------ .../DependencyInjection/RuworkAwsExtension.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/AwsBundle/Client/AwsSdks.php b/src/AwsBundle/Client/AwsSdks.php index d026f1f..80665a9 100644 --- a/src/AwsBundle/Client/AwsSdks.php +++ b/src/AwsBundle/Client/AwsSdks.php @@ -5,26 +5,26 @@ namespace Ruwork\AwsBundle\Client; use Aws\Sdk; -use Symfony\Component\DependencyInjection\ServiceLocator; +use Psr\Container\ContainerInterface; final class AwsSdks { - private $locator; + private $container; private $defaultName; - public function __construct(ServiceLocator $locator, string $defaultName) + public function __construct(ContainerInterface $container, string $defaultName) { - $this->locator = $locator; + $this->container = $container; $this->defaultName = $defaultName; } public function has(string $name): bool { - return $this->locator->has($name); + return $this->container->has($name); } public function get(?string $name = null): Sdk { - return $this->locator->get($name ?? $this->defaultName); + return $this->container->get($name ?? $this->defaultName); } } diff --git a/src/AwsBundle/DependencyInjection/RuworkAwsExtension.php b/src/AwsBundle/DependencyInjection/RuworkAwsExtension.php index d480de9..5254cb2 100644 --- a/src/AwsBundle/DependencyInjection/RuworkAwsExtension.php +++ b/src/AwsBundle/DependencyInjection/RuworkAwsExtension.php @@ -44,7 +44,7 @@ public function loadInternal(array $config, ContainerBuilder $container): void $container ->findDefinition(AwsSdks::class) ->setArguments([ - '$locator' => ServiceLocatorTagPass::register($container, $references), + '$container' => ServiceLocatorTagPass::register($container, $references), '$defaultName' => $config['default_sdk'], ]); }