Skip to content

Commit fe3801c

Browse files
committed
Merge remote-tracking branch 'remotes/origin/7.0'
2 parents e1a6398 + 7678794 commit fe3801c

File tree

5 files changed

+26
-15
lines changed

5 files changed

+26
-15
lines changed

Command/AbstractIndexServiceAwareCommand.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313

1414
use ONGR\ElasticsearchBundle\DependencyInjection\Configuration;
1515
use ONGR\ElasticsearchBundle\Service\IndexService;
16-
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
1716
use Symfony\Component\Console\Command\Command;
1817
use Symfony\Component\Console\Input\InputOption;
1918
use Symfony\Component\DependencyInjection\Container;
19+
use Symfony\Component\DependencyInjection\ContainerInterface;
2020

2121
abstract class AbstractIndexServiceAwareCommand extends Command
2222
{
2323
private $container;
2424

2525
const INDEX_OPTION = 'index';
2626

27-
public function __construct(Container $container)
27+
public function __construct(ContainerInterface $container)
2828
{
2929
$this->container = $container;
3030
parent::__construct();
@@ -58,7 +58,7 @@ protected function getIndex($name): IndexService
5858
);
5959
}
6060

61-
public function getContainer(): Container
61+
public function getContainer(): ContainerInterface
6262
{
6363
return $this->container;
6464
}

DependencyInjection/Compiler/MappingPass.php

+17-8
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,23 @@ private function handleDirectoryMapping(ContainerBuilder $container, string $dir
7575
$indexMetadata = $parser->getIndexMetadata($class);
7676

7777
if (!empty($indexMetadata)) {
78-
$indexMetadata['settings'] = array_filter(array_merge_recursive(
79-
$indexMetadata['settings'] ?? [],
80-
[
81-
'number_of_replicas' => $document->numberOfReplicas,
82-
'number_of_shards' => $document->numberOfShards,
83-
],
84-
$indexesOverride[$namespace]['settings'] ?? []
85-
));
78+
$indexMetadata['settings'] = array_filter(
79+
array_replace_recursive(
80+
$indexMetadata['settings'] ?? [],
81+
[
82+
'number_of_replicas' => $document->numberOfReplicas,
83+
'number_of_shards' => $document->numberOfShards,
84+
],
85+
$indexesOverride[$namespace]['settings'] ?? []
86+
),
87+
function ($value) {
88+
if (0 === $value) {
89+
return true;
90+
}
91+
92+
return (bool)$value;
93+
}
94+
);
8695

8796
$indexSettings = new Definition(
8897
IndexSettings::class,

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class Product
138138
public $id;
139139

140140
/**
141-
* @ES\Property(type="text", "analyzer"="eNgramAnalyzer")
141+
* @ES\Property(type="text", analyzer="eNgramAnalyzer")
142142
*/
143143
public $title;
144144

Resources/config/services.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ parameters:
33

44
services:
55

6-
_defaults: { public: true }
6+
_defaults:
7+
public: true
8+
autowire: true
79

810
ONGR\ElasticsearchBundle\Command\:
911
resource: '../../Command'
@@ -45,4 +47,4 @@ services:
4547
ONGR\ElasticsearchBundle\EventListener\TerminateListener:
4648
arguments: ["@service_container", "%ongr.esb.indexes%"]
4749
tags:
48-
- { name: kernel.event_listener, event: kernel.terminate }
50+
- { name: kernel.event_listener, event: kernel.terminate }

Result/DocumentIterator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ protected function convertDocument(array $raw)
4141
$data = $raw['_source'] ?? $raw['_fields'] ?? null;
4242
$data['_id'] = $raw['_id'] ?? null;
4343

44-
return $this->getConverter()->convertArrayToDocument($this->getIndex()->getNamespace(), array_filter($data));
44+
return $this->getConverter()->convertArrayToDocument($this->getIndex()->getNamespace(), $data);
4545
}
4646
}

0 commit comments

Comments
 (0)