Skip to content

Commit aef5940

Browse files
committed
Merge branch 'pr/760' into 3.0.x
2 parents c4a2858 + b9b0c1b commit aef5940

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

Configuration/Source/ContainerSource.php

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,7 @@ public function getConfiguration()
4040
{
4141
$indexes = array();
4242
foreach ($this->configArray as $config) {
43-
$types = array();
44-
foreach ($config['types'] as $typeConfig) {
45-
$types[$typeConfig['name']] = new TypeConfig(
46-
$typeConfig['name'],
47-
$typeConfig['mapping'],
48-
$typeConfig['config']
49-
);
50-
// TODO: handle prototypes..
51-
}
52-
43+
$types = $this->getTypes($config);
5344
$index = new IndexConfig($config['name'], $types, array(
5445
'elasticSearchName' => $config['elasticsearch_name'],
5546
'settings' => $config['settings'],
@@ -61,4 +52,28 @@ public function getConfiguration()
6152

6253
return $indexes;
6354
}
55+
56+
/**
57+
* Builds TypeConfig objects for each type.
58+
*
59+
* @param array $config
60+
* @return array
61+
*/
62+
protected function getTypes($config)
63+
{
64+
$types = array();
65+
66+
if (isset($config['types'])) {
67+
foreach ($config['types'] as $typeConfig) {
68+
$types[$typeConfig['name']] = new TypeConfig(
69+
$typeConfig['name'],
70+
$typeConfig['mapping'],
71+
$typeConfig['config']
72+
);
73+
// TODO: handle prototypes..
74+
}
75+
}
76+
77+
return $types;
78+
}
6479
}

Tests/Functional/app/Basic/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,4 @@ fos_elastica:
9292
identifier: "id"
9393
null_mappings:
9494
mappings: ~
95+
empty_index: ~

0 commit comments

Comments
 (0)