\Cake\DatasourceFactoryLocator

Class FactoryLocator

Summary

Methods
Properties
Constants
add()
drop()
get()
No public properties found
No constants found
No protected methods found
$_modelFactories
N/A
No private methods found
No private properties found
N/A

Properties

$_modelFactories

$_modelFactories : array<mixed,callable>

A list of model factory functions.

Type

array<mixed,callable>

Methods

add()

add(string  $type, callable  $factory) : void

Register a callable to generate repositories of a given type.

Parameters

string $type

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

callable $factory

The factory function used to create instances.

drop()

drop(string  $type) : void

Drop a model factory.

Parameters

string $type

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

get()

get(string  $type) : callable

Get the factory for the specified repository type.

Parameters

string $type

The repository type to get the factory for.

Throws

\InvalidArgumentException

If the specified repository type has no factory.

Returns

callable —

The factory for the repository type.