Fr3nch13/CakePHP Utilities

FactoryLocator
in package

Class FactoryLocator

Table of Contents

Properties

$_modelFactories  : array<string|int, callable|LocatorInterface>
A list of model factory functions.

Methods

add()  : void
Register a callable to generate repositories of a given type.
drop()  : void
Drop a model factory.
get()  : LocatorInterface|callable
Get the factory for the specified repository type.

Properties

Methods

add()

Register a callable to generate repositories of a given type.

public static add(string $type, LocatorInterface|callable $factory) : void
Parameters
$type : string

The name of the repository type the factory function is for.

$factory : LocatorInterface|callable

The factory function used to create instances.

drop()

Drop a model factory.

public static drop(string $type) : void
Parameters
$type : string

The name of the repository type to drop the factory for.

get()

Get the factory for the specified repository type.

public static get(string $type) : LocatorInterface|callable
Parameters
$type : string

The repository type to get the factory for.

Tags
throws
InvalidArgumentException

If the specified repository type has no factory.

Return values
LocatorInterface|callable

The factory for the repository type.


        
On this page

Search results