FOSElasticaBundle/Reseter.php
2011-04-12 15:15:19 -07:00

30 lines
493 B
PHP

<?php
namespace FOQ\ElasticaBundle;
/**
* Deletes and recreates indexes
**/
class Reseter
{
protected $indexManager;
public function __construct(IndexManager $indexManager)
{
$this->indexManager = $indexManager;
}
/**
* Resets all indexes
*
* @return null
**/
public function reset()
{
foreach ($this->indexManager->getAllIndexes() as $index) {
$index->delete();
$index->create();
}
}
}