From 428d21e4c50b4455cf808cea4eb909f6235fb067 Mon Sep 17 00:00:00 2001 From: Toni Rudolf Date: Fri, 7 Feb 2020 09:31:09 +0100 Subject: [PATCH] Fix autowiring (#913) --- Command/AbstractIndexServiceAwareCommand.php | 6 +++--- Resources/config/services.yml | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Command/AbstractIndexServiceAwareCommand.php b/Command/AbstractIndexServiceAwareCommand.php index c9825dd4..27b33111 100644 --- a/Command/AbstractIndexServiceAwareCommand.php +++ b/Command/AbstractIndexServiceAwareCommand.php @@ -13,10 +13,10 @@ use ONGR\ElasticsearchBundle\DependencyInjection\Configuration; use ONGR\ElasticsearchBundle\Service\IndexService; -use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\ContainerInterface; abstract class AbstractIndexServiceAwareCommand extends Command { @@ -24,7 +24,7 @@ abstract class AbstractIndexServiceAwareCommand extends Command const INDEX_OPTION = 'index'; - public function __construct(Container $container) + public function __construct(ContainerInterface $container) { $this->container = $container; parent::__construct(); @@ -58,7 +58,7 @@ protected function getIndex($name): IndexService ); } - public function getContainer(): Container + public function getContainer(): ContainerInterface { return $this->container; } diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 6b9ac085..7d4bbb3f 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -3,7 +3,9 @@ parameters: services: - _defaults: { public: true } + _defaults: + public: true + autowire: true ONGR\ElasticsearchBundle\Command\: resource: '../../Command' @@ -45,4 +47,4 @@ services: ONGR\ElasticsearchBundle\EventListener\TerminateListener: arguments: ["@service_container", "%ongr.esb.indexes%"] tags: - - { name: kernel.event_listener, event: kernel.terminate } \ No newline at end of file + - { name: kernel.event_listener, event: kernel.terminate }