Fix indexable callbacks with alias based indexes

This commit is contained in:
Tim Nagel 2014-06-17 12:03:38 +10:00
commit aafb8c8e89
13 changed files with 61 additions and 60 deletions

View file

@ -11,18 +11,31 @@ use Elastica\Index;
*/
class DynamicIndex extends Index
{
private $originalName;
/**
* Reassign index name
*
* While it's technically a regular setter for name property, it's specifically named overrideName, but not setName
* since it's used for a very specific case and normally should not be used
* While it's technically a regular setter for name property, it's specifically named
* overrideName, but not setName since it's used for a very specific case and normally
* should not be used.
*
* @param string $name Index name
*
* @return void
*/
public function overrideName($name)
{
$this->originalName = $this->_name;
$this->_name = $name;
}
/**
* Returns the original name of the index if the index has been renamed for reindexing
* or realiasing purposes.
*
* @return string
*/
public function getOriginalName()
{
return $this->originalName ?: $this->_name;
}
}