Fix indexable callbacks with alias based indexes
This commit is contained in:
parent
e225d841ed
commit
aafb8c8e89
13 changed files with 61 additions and 60 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue