Documentation

TaggedContainerInterface extends ContainerInterface

TaggedContainerInterface is the interface implemented when a container knows how to deals with tags.

Tags
author

Fabien Potencier fabien@symfony.com

Table of Contents

Constants

EXCEPTION_ON_INVALID_REFERENCE  = 1
IGNORE_ON_INVALID_REFERENCE  = 3
IGNORE_ON_UNINITIALIZED_REFERENCE  = 4
NULL_ON_INVALID_REFERENCE  = 2
RUNTIME_EXCEPTION_ON_INVALID_REFERENCE  = 0

Methods

findTaggedServiceIds()  : array<string|int, mixed>
Returns service ids for a given tag.
get()  : mixed
Finds an entry of the container by its identifier and returns it.
getParameter()  : array<string|int, mixed>|bool|string|int|float|UnitEnum|null
has()  : bool
Returns true if the container can return an entry for the given identifier.
hasParameter()  : bool
initialized()  : bool
Check for whether or not a service has been initialized.
set()  : void
setParameter()  : void

Constants

IGNORE_ON_UNINITIALIZED_REFERENCE

public mixed IGNORE_ON_UNINITIALIZED_REFERENCE = 4

RUNTIME_EXCEPTION_ON_INVALID_REFERENCE

public mixed RUNTIME_EXCEPTION_ON_INVALID_REFERENCE = 0

Methods

findTaggedServiceIds()

Returns service ids for a given tag.

public findTaggedServiceIds(string $name) : array<string|int, mixed>
Parameters
$name : string

The tag name

Return values
array<string|int, mixed>

get()

Finds an entry of the container by its identifier and returns it.

public get(string $id[, B $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE ]) : mixed
Parameters
$id : string

Identifier of the entry to look for.

$invalidBehavior : B = self::EXCEPTION_ON_INVALID_REFERENCE
Tags
template
psalm-return

(B is self::EXCEPTION_ON_INVALID_REFERENCE|self::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE ? object : object|null)

throws
ServiceCircularReferenceException

When a circular reference is detected

throws
ServiceNotFoundException

When the service is not defined

see
Reference
Return values
mixed

Entry.

getParameter()

public getParameter(string $name) : array<string|int, mixed>|bool|string|int|float|UnitEnum|null
Parameters
$name : string
Tags
throws
ParameterNotFoundException

if the parameter is not defined

Return values
array<string|int, mixed>|bool|string|int|float|UnitEnum|null

has()

Returns true if the container can return an entry for the given identifier.

public has(string $id) : bool

Returns false otherwise.

has($id) returning true does not mean that get($id) will not throw an exception. It does however mean that get($id) will not throw a NotFoundExceptionInterface.

Parameters
$id : string

Identifier of the entry to look for.

Return values
bool

hasParameter()

public hasParameter(string $name) : bool
Parameters
$name : string
Return values
bool

initialized()

Check for whether or not a service has been initialized.

public initialized(string $id) : bool
Parameters
$id : string
Return values
bool

set()

public set(string $id, object|null $service) : void
Parameters
$id : string
$service : object|null

setParameter()

public setParameter(string $name, array<string|int, mixed>|bool|string|int|float|UnitEnum|null $value) : void
Parameters
$name : string
$value : array<string|int, mixed>|bool|string|int|float|UnitEnum|null

        
On this page

Search results