Class FactoryLocator
Class FactoryLocator
Namespace: Cake\Datasource
Property Summary
-
$_modelFactories protected static
array<string, \Cake\Datasource\Locator\LocatorInterface>A list of model factory functions.
Method Summary
-
add() public static
Register a locator to return repositories of a given type.
-
drop() public static
Drop a model factory.
-
get() public static
Get the factory for the specified repository type.
Method Detail
add() ¶ public static
add(string $type, Cake\Datasource\Locator\LocatorInterface $factory): void
Register a locator to return repositories of a given type.
Parameters
-
string$type The name of the repository type the factory function is for.
-
Cake\Datasource\Locator\LocatorInterface$factory The factory function used to create instances.
Returns
voiddrop() ¶ public static
drop(string $type): void
Drop a model factory.
Parameters
-
string$type The name of the repository type to drop the factory for.
Returns
voidget() ¶ public static
get(string $type): Cake\Datasource\Locator\LocatorInterface
Get the factory for the specified repository type.
Parameters
-
string$type The repository type to get the factory for.
Returns
Cake\Datasource\Locator\LocatorInterfaceThe factory for the repository type.
Throws
InvalidArgumentExceptionIf the specified repository type has no factory.
Property Detail
$_modelFactories ¶ protected static
A list of model factory functions.
Type
array<string, \Cake\Datasource\Locator\LocatorInterface>