W3cubDocs

/CakePHP 3.8

Class FactoryLocator

Class FactoryLocator

Properties summary

  • $_modelFactories protected static
    callable[]
    A list of model factory functions.

Method Summary

  • add() public static
    Register a callable to generate 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()source public static

add( string $type , callable $factory )

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()source public static

drop( string $type )

Drop a model factory.

Parameters

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

get()source public static

get( string $type )

Get the factory for the specified repository type.

Parameters

string $type
The repository type to get the factory for.

Returns

callable
The factory for the repository type.

Throws

InvalidArgumentException
If the specified repository type has no factory.

Properties detail

$_modelFactoriessource

protected static callable[]

A list of model factory functions.

[]

© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.8/class-Cake.Datasource.FactoryLocator.html