| Methods |
public
|
__construct(string $class = null, array $arguments = [])
|
#
|
public
|
getChanges(): array
Returns all changes tracked for the Definition object.
Returns all changes tracked for the Definition object.
|
#
|
public
|
setChanges(array $changes): $this
Sets the tracked changes for the Definition object.
Sets the tracked changes for the Definition object.
Parameters
| $changes |
An array of changes for this Definition
|
|
#
|
public
|
setFactory(string|array|Reference|null $factory): $this
Sets a factory.
Parameters
| $factory |
A PHP function, reference or an array containing a class/Reference and a method to call
|
|
#
|
public
|
getFactory(): string|array|null
Gets the factory.
Returns
The PHP function or an array containing a class/Reference and a method to call
|
#
|
public
|
setDecoratedService(
string|null $id,
string|null $renamedId = null,
int $priority = 0,
int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
): $this
Sets the service that this service is decorating.
Sets the service that this service is decorating.
Parameters
| $id |
The decorated service id, use null to remove decoration
|
| $renamedId |
The new decorated service id
|
Throws
|
#
|
public
|
getDecoratedService(): array|null
Gets the service that this service is decorating.
Gets the service that this service is decorating.
Returns
An array composed of the decorated service id, the new id for it and the priority of decoration, null if no service is decorated
|
#
|
public
|
setClass(?string $class): $this
Sets the service class.
|
#
|
public
|
getClass(): ?string
Gets the service class.
|
#
|
public
|
setArguments(array $arguments): $this
Sets the arguments to pass to the service constructor/factory method.
Sets the arguments to pass to the service constructor/factory method.
|
#
|
public
|
setProperties(array $properties): $this
Sets the properties to define when creating the service.
Sets the properties to define when creating the service.
|
#
|
public
|
getProperties(): array
Gets the properties to define when creating the service.
Gets the properties to define when creating the service.
|
#
|
public
|
setProperty(string $name, mixed $value): $this
Sets a specific property.
Sets a specific property.
|
#
|
public
|
addArgument(mixed $argument): $this
Adds an argument to pass to the service constructor/factory method.
Adds an argument to pass to the service constructor/factory method.
|
#
|
public
|
replaceArgument(int|string $index, mixed $argument): $this
Replaces a specific argument.
Replaces a specific argument.
Throws
Overriden by
|
#
|
public
|
setArgument(int|string $key, mixed $value): $this
Sets a specific argument.
Sets a specific argument.
|
#
|
public
|
getArguments(): array
Gets the arguments to pass to the service constructor/factory method.
Gets the arguments to pass to the service constructor/factory method.
|
#
|
public
|
getArgument(int|string $index): mixed
Gets an argument to pass to the service constructor/factory method.
Gets an argument to pass to the service constructor/factory method.
Throws
Overriden by
|
#
|
public
|
setMethodCalls(array $calls = []): $this
Sets the methods to call after service initialization.
Sets the methods to call after service initialization.
|
#
|
public
|
addMethodCall(string $method, array $arguments = [], bool $returnsClone = false): $this
Adds a method to call after service initialization.
Adds a method to call after service initialization.
Parameters
| $method |
The method name to call
|
| $arguments |
An array of arguments to pass to the method call
|
| $returnsClone |
Whether the call returns the service instance or not
|
Throws
|
#
|
public
|
removeMethodCall(string $method): $this
Removes a method to call after service initialization.
Removes a method to call after service initialization.
|
#
|
public
|
hasMethodCall(string $method): bool
Check if the current definition has a given method to call after service initialization.
Check if the current definition has a given method to call after service initialization.
|
#
|
public
|
getMethodCalls(): array
Gets the methods to call after service initialization.
Gets the methods to call after service initialization.
|
#
|
public
|
setInstanceofConditionals(ChildDefinition[] $instanceof): $this
Sets the definition templates to conditionally apply on the current definition, keyed by parent interface/class.
Sets the definition templates to conditionally apply on the current definition, keyed by parent interface/class.
|
#
|
public
|
getInstanceofConditionals(): ChildDefinition[]
Gets the definition templates to conditionally apply on the current definition, keyed by parent interface/class.
Gets the definition templates to conditionally apply on the current definition, keyed by parent interface/class.
|
#
|
public
|
setAutoconfigured(bool $autoconfigured): $this
Sets whether or not instanceof conditionals should be prepended with a global set.
Sets whether or not instanceof conditionals should be prepended with a global set.
|
#
|
public
|
isAutoconfigured(): bool
|
#
|
public
|
setTags(array $tags): $this
Sets tags for this definition.
Sets tags for this definition.
|
#
|
public
|
getTags(): array
Returns all tags.
|
#
|
public
|
getTag(string $name): array
Gets a tag by name.
|
#
|
public
|
addTag(string $name, array $attributes = []): $this
Adds a tag for this definition.
Adds a tag for this definition.
|
#
|
public
|
hasTag(string $name): bool
Whether this definition has a tag with the given name.
Whether this definition has a tag with the given name.
|
#
|
public
|
clearTag(string $name): $this
Clears all tags for a given name.
Clears all tags for a given name.
|
#
|
public
|
clearTags(): $this
Clears the tags for this definition.
Clears the tags for this definition.
|
#
|
public
|
setFile(?string $file): $this
Sets a file to require before creating the service.
Sets a file to require before creating the service.
|
#
|
public
|
getFile(): ?string
Gets the file to require before creating the service.
Gets the file to require before creating the service.
|
#
|
public
|
setShared(bool $shared): $this
Sets if the service must be shared or not.
Sets if the service must be shared or not.
|
#
|
public
|
isShared(): bool
Whether this service is shared.
Whether this service is shared.
|
#
|
public
|
setPublic(bool $boolean): $this
Sets the visibility of this service.
Sets the visibility of this service.
|
#
|
public
|
isPublic(): bool
Whether this service is public facing.
Whether this service is public facing.
|
#
|
public
|
isPrivate(): bool
Whether this service is private.
Whether this service is private.
|
#
|
public
|
setLazy(bool $lazy): $this
Sets the lazy flag of this service.
Sets the lazy flag of this service.
|
#
|
public
|
isLazy(): bool
Whether this service is lazy.
Whether this service is lazy.
|
#
|
public
|
setSynthetic(bool $boolean): $this
Sets whether this definition is synthetic, that is not constructed by the
container, but dynamically injected.
Sets whether this definition is synthetic, that is not constructed by the
container, but dynamically injected.
|
#
|
public
|
isSynthetic(): bool
Whether this definition is synthetic, that is not constructed by the
container, but dynamically injected.
Whether this definition is synthetic, that is not constructed by the
container, but dynamically injected.
|
#
|
public
|
setAbstract(bool $boolean): $this
Whether this definition is abstract, that means it merely serves as a
template for other definitions.
Whether this definition is abstract, that means it merely serves as a
template for other definitions.
|
#
|
public
|
isAbstract(): bool
Whether this definition is abstract, that means it merely serves as a
template for other definitions.
Whether this definition is abstract, that means it merely serves as a
template for other definitions.
|
#
|
public
|
setDeprecated(string $package, string $version, string $message): $this
Whether this definition is deprecated, that means it should not be called
anymore.
Whether this definition is deprecated, that means it should not be called
anymore.
Parameters
| $package |
The name of the composer package that is triggering the deprecation
|
| $version |
The version of the package that introduced the deprecation
|
| $message |
The deprecation message to use
|
Throws
|
#
|
public
|
isDeprecated(): bool
Whether this definition is deprecated, that means it should not be called
anymore.
Whether this definition is deprecated, that means it should not be called
anymore.
|
#
|
public
|
getDeprecation(string $id): array
Parameters
| $id |
Service id relying on this definition
|
|
#
|
public
|
setConfigurator(string|array|Reference|null $configurator): $this
Sets a configurator to call after the service is fully initialized.
Sets a configurator to call after the service is fully initialized.
Parameters
| $configurator |
A PHP function, reference or an array containing a class/Reference and a method to call
|
|
#
|
public
|
getConfigurator(): string|array|null
Gets the configurator to call after the service is fully initialized.
Gets the configurator to call after the service is fully initialized.
|
#
|
public
|
isAutowired(): bool
Is the definition autowired?
Is the definition autowired?
|
#
|
public
|
setAutowired(bool $autowired): $this
Enables/disables autowiring.
Enables/disables autowiring.
|
#
|
public
|
getBindings(): BoundArgument[]
Gets bindings.
|
#
|
public
|
setBindings(array $bindings): $this
Sets bindings.
Sets bindings.
Bindings map $named or FQCN arguments to values that should be
injected in the matching parameters (of the constructor, of methods
called and of controller actions).
|
#
|
public
|
addError(string|Closure|Definition $error): $this
Add an error that occurred when building this Definition.
Add an error that occurred when building this Definition.
|
#
|
public
|
getErrors(): array
Returns any errors that occurred while building this Definition.
Returns any errors that occurred while building this Definition.
|
#
|
public
|
hasErrors(): bool
|
#
|