PHP Class Cake\ElasticSearch\TypeRegistry

Handles ensuring only one instance of each type is created and that the correct connection is injected in. Provides an interface similar to Cake\ORM\TableRegistry.
Show file Open project: cakephp/elastic-search Class Usage Examples

Protected Properties

Property Type Description
$instances array The map of instances in the registry.
$options array List of options by alias passed to get.

Public Methods

Method Description
clear ( ) : void Clears the registry of configuration and instances.
exists ( string $alias ) : boolean Check to see if an instance exists in the registry.
get ( string $alias, array $options = [] ) : Type Get/Create an instance from the registry.
remove ( string $alias ) : void Removes an instance from the registry.
set ( string $alias, Type $object ) : Type Set an instance.

Method Details

clear() public static method

Clears the registry of configuration and instances.
public static clear ( ) : void
return void

exists() public static method

Check to see if an instance exists in the registry.
public static exists ( string $alias ) : boolean
$alias string The alias to check for.
return boolean

get() public static method

When getting an instance, if it does not already exist, a new instance will be created using the provide alias, and options.
public static get ( string $alias, array $options = [] ) : Type
$alias string The name of the alias to get.
$options array Configuration options for the type constructor.
return Type

remove() public static method

Removes an instance from the registry.
public static remove ( string $alias ) : void
$alias string The alias to remove.
return void

set() public static method

Set an instance.
public static set ( string $alias, Type $object ) : Type
$alias string The alias to set.
$object Type The type to set.
return Type

Property Details

$instances protected static property

The map of instances in the registry.
protected static array $instances
return array

$options protected static property

List of options by alias passed to get.
protected static array $options
return array