Menu

## FactoryDefinitionHelper
in package
implements DefinitionHelper

FactoryDefinitionHelper.php : 15

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

#### $decorate

FactoryDefinitionHelper.php : 22
`private bool $decorate`

#### $factory

FactoryDefinitionHelper.php : 20
`private callable $factory`

#### $parameters

FactoryDefinitionHelper.php : 24
`private array<string|int, mixed> $parameters = []`

### Methods

#### __construct()

FactoryDefinitionHelper.php : 29
`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?

#### getDefinition()

FactoryDefinitionHelper.php : 35
`public getDefinition(string $entryName) : FactoryDefinition`

##### Parameters

$entryName : string

  Container entry name

##### Return values

FactoryDefinition

#### parameter()

FactoryDefinitionHelper.php : 57

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

## Search results