Skip to content

Commit 8ebc384

Browse files
committed
Merge remote-tracking branch 'remotes/origin/6.2' into es7_support
# Conflicts: # .travis.yml # composer.json
2 parents 62bf578 + a00f5a6 commit 8ebc384

31 files changed

+99
-822
lines changed

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@ php:
44
- 7.1
55
- 7.2
66
- 7.3
7+
- 7.4
78
env:
89
global:
910
- ES_VERSION=7.5.2 ES_DOWNLOAD_URL=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}-linux-x86_64.tar.gz
1011
matrix:
11-
- SYMFONY="~3.4"
1212
- SYMFONY="^4.4"
13+
- SYMFONY="^5.0"
14+
jobs:
15+
exclude:
16+
- php: 7.1
17+
env: SYMFONY="^5.0"
1318
install:
1419
- wget ${ES_DOWNLOAD_URL}
1520
- tar -xzf elasticsearch-${ES_VERSION}-linux-x86_64.tar.gz

Command/AbstractIndexServiceAwareCommand.php

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,22 @@
1414
use ONGR\ElasticsearchBundle\DependencyInjection\Configuration;
1515
use ONGR\ElasticsearchBundle\Service\IndexService;
1616
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
17+
use Symfony\Component\Console\Command\Command;
1718
use Symfony\Component\Console\Input\InputOption;
19+
use Symfony\Component\DependencyInjection\Container;
1820

19-
abstract class AbstractIndexServiceAwareCommand extends ContainerAwareCommand
21+
abstract class AbstractIndexServiceAwareCommand extends Command
2022
{
23+
private $container;
24+
2125
const INDEX_OPTION = 'index';
2226

27+
public function __construct(Container $container)
28+
{
29+
$this->container = $container;
30+
parent::__construct();
31+
}
32+
2333
protected function configure()
2434
{
2535
$this->addOption(
@@ -32,19 +42,24 @@ protected function configure()
3242

3343
protected function getIndex($name): IndexService
3444
{
35-
$name = $name ?? $this->getContainer()->getParameter(Configuration::ONGR_DEFAULT_INDEX);
36-
$indexes = $this->getContainer()->getParameter(Configuration::ONGR_INDEXES);
45+
$name = $name ?? $this->container->getParameter(Configuration::ONGR_DEFAULT_INDEX);
46+
$indexes = $this->container->getParameter(Configuration::ONGR_INDEXES);
3747

38-
if (isset($indexes[$name]) && $this->getContainer()->has($indexes[$name])) {
39-
return $this->getContainer()->get($indexes[$name]);
48+
if (isset($indexes[$name]) && $this->container->has($indexes[$name])) {
49+
return $this->container->get($indexes[$name]);
4050
}
4151

4252
throw new \RuntimeException(
4353
sprintf(
4454
'There is no index under `%s` name found. Available options: `%s`.',
4555
$name,
46-
implode('`, `', array_keys($this->getContainer()->getParameter(Configuration::ONGR_INDEXES)))
56+
implode('`, `', array_keys($this->container->getParameter(Configuration::ONGR_INDEXES)))
4757
)
4858
);
4959
}
60+
61+
public function getContainer(): Container
62+
{
63+
return $this->container;
64+
}
5065
}

Command/CacheClearCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
4646
$index->getIndexName()
4747
)
4848
);
49+
50+
return 0;
4951
}
5052
}

0 commit comments

Comments
 (0)