Class
IndexRegistry
Factory/Registry class for Index objects.
Handles ensuring only one instance of each index is created and that the correct connection is injected in.
Provides an interface similar to Cake\ORM\TableRegistry.
Deprecated: 3.4.3 Statically accesible registry is deprecated. Prefer using `IndexLocator` alongside the `LocatorTrait` in CakePHP.
Property Summary
-
$locator protected static
Cake\ElasticSearch\Datasource\IndexLocator
The locator that the global registy is wrapping.
Method Summary
-
clear() public
Clears the registry of configuration and instances.
-
exists() public
Check to see if an instance exists in the registry.
-
get() public
Get/Create an instance from the registry.
-
getLocator() protected static
Get the wrapped locator.
-
remove() public
Removes an instance from the registry.
-
set() public
Set an instance.
-
setFallbackClassName() public static
Set fallback class name.
Method Detail
exists() ¶ public
exists(string $alias): bool
Check to see if an instance exists in the registry.
Parameters
-
string
$alias The alias to check for.
Returns
bool
get() ¶ public
get(string $alias, array<string, mixed> $options = []): Cake\ElasticSearch\Index
Get/Create an instance from the registry.
When getting an instance, if it does not already exist, a new instance will be created using the provide alias, and options.
Parameters
-
string
$alias The name of the alias to get.
-
array<string, mixed>
$options optional Configuration options for the type constructor.
Returns
Cake\ElasticSearch\Index
getLocator() ¶ protected static
getLocator(): Cake\ElasticSearch\Datasource\IndexLocator
Get the wrapped locator.
Returns
Cake\ElasticSearch\Datasource\IndexLocator
remove() ¶ public
remove(string $alias): void
Removes an instance from the registry.
Parameters
-
string
$alias The alias to remove.
Returns
void
set() ¶ public
set(string $alias, Cake\Datasource\RepositoryInterface $repository): Cake\ElasticSearch\Index
Set an instance.
Parameters
-
string
$alias The alias to set.
-
Cake\Datasource\RepositoryInterface
$repository The type to set.
Returns
Cake\ElasticSearch\Index
setFallbackClassName() ¶ public static
setFallbackClassName(string $className): void
Set fallback class name.
The class that should be used to create a index instance if a concrete
class for alias used in get()
could not be found. Defaults to
Cake\ElasticSearch\Index
.
Parameters
-
string
$className Fallback class name
Returns
void
Property Detail
$locator ¶ protected static
The locator that the global registy is wrapping.
Type
Cake\ElasticSearch\Datasource\IndexLocator