Documentation

FactoryDefinitionHelper
in package
implements DefinitionHelper

Helps defining how to create an instance of a class using a factory (callable).

Tags
author

Matthieu Napoli matthieu@mnapoli.fr

Table of Contents

Interfaces

DefinitionHelper
Helps defining container entries.

Properties

$decorate  : bool
$factory  : callable
$parameters  : array<string|int, mixed>

Methods

__construct()  : mixed
getDefinition()  : FactoryDefinition
parameter()  : $this
Defines arguments to pass to the factory.

Properties

Methods

__construct()

public __construct(callable|array<string|int, mixed>|string $factory[, bool $decorate = false ]) : mixed
Parameters
$factory : callable|array<string|int, mixed>|string
$decorate : bool = false

Is the factory decorating a previous definition?

parameter()

Defines arguments to pass to the factory.

public parameter(string $parameter, mixed $value) : $this

Because factory methods do not yet support attributes or autowiring, this method should be used to define all parameters except the ContainerInterface and RequestedEntry.

Multiple calls can be made to the method to override individual values.

Parameters
$parameter : string

Name or index of the parameter for which the value will be given.

$value : mixed

Value to give to this parameter.

Return values
$this

        
On this page

Search results