PHP Class ContainerInteropDoctrine\AbstractFactory

Show file Open project: dasprid/container-interop-doctrine Class Usage Examples

Public Methods

Method Description
__callStatic ( string $name, array $arguments ) : mixed Creates a new instance from a specified config, specifically meant to be used as static factory.
__construct ( string $configKey = 'orm_default' )
__invoke ( Interop\Container\ContainerInterface $container ) : mixed

Protected Methods

Method Description
createWithConfig ( Interop\Container\ContainerInterface $container, string $configKey ) : mixed Creates a new instance from a specified config.
getDefaultConfig ( string $configKey ) : array Returns the default config.
retrieveConfig ( Interop\Container\ContainerInterface $container, string $configKey, string $section ) : array Retrieves the config for a specific section.
retrieveDependency ( Interop\Container\ContainerInterface $container, string $configKey, string $section, string $factoryClassName ) : mixed Retrieves a dependency through the container.

Method Details

__callStatic() public static method

In case you want to use another config key than "orm_default", you can add the following factory to your config: [SpecificFactory::class, 'orm_other'], ];
public static __callStatic ( string $name, array $arguments ) : mixed
$name string
$arguments array
return mixed

__construct() public method

public __construct ( string $configKey = 'orm_default' )
$configKey string

__invoke() public method

public __invoke ( Interop\Container\ContainerInterface $container ) : mixed
$container Interop\Container\ContainerInterface
return mixed

createWithConfig() abstract protected method

Creates a new instance from a specified config.
abstract protected createWithConfig ( Interop\Container\ContainerInterface $container, string $configKey ) : mixed
$container Interop\Container\ContainerInterface
$configKey string
return mixed

getDefaultConfig() abstract protected method

Returns the default config.
abstract protected getDefaultConfig ( string $configKey ) : array
$configKey string
return array

retrieveConfig() protected method

Retrieves the config for a specific section.
protected retrieveConfig ( Interop\Container\ContainerInterface $container, string $configKey, string $section ) : array
$container Interop\Container\ContainerInterface
$configKey string
$section string
return array

retrieveDependency() protected method

If the container does not know about the dependency, it is pulled from a fresh factory. This saves the user from registering factories which they are not gonna access themself at all, and thus minimized configuration.
protected retrieveDependency ( Interop\Container\ContainerInterface $container, string $configKey, string $section, string $factoryClassName ) : mixed
$container Interop\Container\ContainerInterface
$configKey string
$section string
$factoryClassName string
return mixed