Fixed mapping issues
This commit is contained in:
parent
b155f304e4
commit
4e990e0cee
14 changed files with 454 additions and 238 deletions
|
|
@ -59,11 +59,11 @@ class IndexConfig
|
|||
*/
|
||||
public function __construct($name, array $types, array $config)
|
||||
{
|
||||
$this->elasticSearchName = $config['elasticSearchName'];
|
||||
$this->elasticSearchName = isset($config['elasticSearchName']) ? $config['elasticSearchName'] : $name;
|
||||
$this->name = $name;
|
||||
$this->settings = $config['settings'];
|
||||
$this->settings = isset($config['settings']) ? $config['settings'] : array();
|
||||
$this->types = $types;
|
||||
$this->useAlias = $config['useAlias'];
|
||||
$this->useAlias = isset($config['useAlias']) ? $config['useAlias'] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -42,10 +42,12 @@ class ContainerSource implements SourceInterface
|
|||
foreach ($this->configArray as $config) {
|
||||
$types = array();
|
||||
foreach ($config['types'] as $typeConfig) {
|
||||
$types[$typeConfig['name']] = new TypeConfig($typeConfig['name'], array(
|
||||
'dynamicTemplates' => $typeConfig['dynamic_templates'],
|
||||
'properties' => $typeConfig['properties'],
|
||||
), $config['type_prototype']);
|
||||
$types[$typeConfig['name']] = new TypeConfig(
|
||||
$typeConfig['name'],
|
||||
$typeConfig['mapping'],
|
||||
$typeConfig['config']
|
||||
);
|
||||
// TODO: handle prototypes..
|
||||
}
|
||||
|
||||
$index = new IndexConfig($config['name'], $types, array(
|
||||
|
|
|
|||
|
|
@ -18,14 +18,43 @@ class TypeConfig
|
|||
*/
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $mapping;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
public function __construct($name, array $config, array $prototype)
|
||||
public function __construct($name, array $mapping, array $config = array())
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->mapping = $mapping;
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getMapping()
|
||||
{
|
||||
return $this->mapping;
|
||||
}
|
||||
|
||||
public function getModel()
|
||||
{
|
||||
return isset($this->config['persistence']['model']) ?
|
||||
$this->config['persistence']['model'] :
|
||||
null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue