FOSElasticaBundle/Resetter.php

34 lines
541 B
PHP
Raw Normal View History

2011-04-13 00:14:00 +02:00
<?php
namespace FOQ\ElasticaBundle;
/**
* Deletes and recreates indexes
**/
class Resetter
2011-04-13 00:14:00 +02:00
{
/**
* Index settings and mappings
*
* @var array
*/
protected $indexConfigs;
2011-04-13 00:14:00 +02:00
public function __construct(array $indexConfigs)
2011-04-13 00:14:00 +02:00
{
$this->indexConfigs = $indexConfigs;
2011-04-13 00:14:00 +02:00
}
/**
* Resets all indexes
*
* @return null
**/
public function reset()
{
foreach ($this->indexConfigs as $indexConfig) {
$indexConfig['index']->create($indexConfig['config'], true);
2011-04-13 00:14:00 +02:00
}
}
}