Move TypeConfig creation to its own method
This commit is contained in:
parent
64fa26e3d9
commit
b9b0c1b961
|
@ -40,6 +40,27 @@ class ContainerSource implements SourceInterface
|
||||||
{
|
{
|
||||||
$indexes = array();
|
$indexes = array();
|
||||||
foreach ($this->configArray as $config) {
|
foreach ($this->configArray as $config) {
|
||||||
|
$types = $this->getTypes($config);
|
||||||
|
$index = new IndexConfig($config['name'], $types, array(
|
||||||
|
'elasticSearchName' => $config['elasticsearch_name'],
|
||||||
|
'settings' => $config['settings'],
|
||||||
|
'useAlias' => $config['use_alias'],
|
||||||
|
));
|
||||||
|
|
||||||
|
$indexes[$config['name']] = $index;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $indexes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds TypeConfig objects for each type.
|
||||||
|
*
|
||||||
|
* @param array $config
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getTypes($config)
|
||||||
|
{
|
||||||
$types = array();
|
$types = array();
|
||||||
|
|
||||||
if (isset($config['types'])) {
|
if (isset($config['types'])) {
|
||||||
|
@ -53,15 +74,6 @@ class ContainerSource implements SourceInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$index = new IndexConfig($config['name'], $types, array(
|
return $types;
|
||||||
'elasticSearchName' => $config['elasticsearch_name'],
|
|
||||||
'settings' => $config['settings'],
|
|
||||||
'useAlias' => $config['use_alias'],
|
|
||||||
));
|
|
||||||
|
|
||||||
$indexes[$config['name']] = $index;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $indexes;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,3 +92,4 @@ fos_elastica:
|
||||||
identifier: "id"
|
identifier: "id"
|
||||||
null_mappings:
|
null_mappings:
|
||||||
mappings: ~
|
mappings: ~
|
||||||
|
empty_index: ~
|
||||||
|
|
Loading…
Reference in a new issue