Fr3nch13/CakePHP Utilities

AbstractLocator
in package
implements LocatorInterface

AbstractYes

Provides an abstract registry/factory for repository objects.

Table of Contents

Interfaces

LocatorInterface
Registries for repository objects should implement this interface.

Properties

$instances  : array<string, RepositoryInterface>
Instances that belong to the registry.
$options  : array<string, array<string|int, mixed>>
Contains a list of options that were passed to get() method.

Methods

clear()  : void
Clears the registry of configuration and instances.
exists()  : bool
Check to see if an instance exists in the registry.
get()  : RepositoryInterface
Get a repository instance from the registry.
remove()  : void
Removes an repository instance from the registry.
set()  : RepositoryInterface
Set a repository instance.
createInstance()  : RepositoryInterface
Create an instance of a given classname.

Properties

$options

Contains a list of options that were passed to get() method.

protected array<string, array<string|int, mixed>> $options = []

Methods

clear()

Clears the registry of configuration and instances.

public clear() : void
Tags
inheritDoc

exists()

Check to see if an instance exists in the registry.

public exists(string $alias) : bool
Parameters
$alias : string

The alias to check for.

Tags
inheritDoc
Return values
bool

get()

Get a repository instance from the registry.

public get(string $alias[, array<string, mixed> $options = [] ]) : RepositoryInterface
Parameters
$alias : string

The alias name you want to get.

$options : array<string, mixed> = []

The options you want to build the table with.

Tags
throws
RuntimeException

When trying to get alias for which instance has already been created with different options.

Return values
RepositoryInterface

remove()

Removes an repository instance from the registry.

public remove(string $alias) : void
Parameters
$alias : string

The alias to remove.

Tags
inheritDoc

createInstance()

Create an instance of a given classname.

protected abstract createInstance(string $alias, array<string, mixed> $options) : RepositoryInterface
Parameters
$alias : string

Repository alias.

$options : array<string, mixed>

The options you want to build the instance with.

Return values
RepositoryInterface

        
On this page

Search results