Container implements SingletonInterface, LoggerAwareInterface uses LoggerAwareTrait
Internal TYPO3 Dependency Injection container
since v11, will be removed in v12. Use symfony DI and GeneralUtility::makeInstance() instead. See TYPO3 explained documentation for more information. Does not trigger_error since the ObjectManager->get() call does that.
only to be used within Extbase, not part of TYPO3 Core API.
Tags
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
- LoggerAwareInterface
Properties
- $instantiator : InstantiatorInterface
Methods
- __construct() : mixed
- getEmptyObject() : object|T
- Create an instance of $className without calling its constructor
- getImplementationClassName() : string
- Returns the class name for a new instance, taking into account the class-extension API.
- getInstance() : object|T
- Main method which should be used to get an instance of the wished class specified by $className.
- registerImplementation() : void
- register a classname that should be used if a dependency is required.
- getInstanceInternal() : object|T
- Internal implementation for getting a class.
- getInstantiator() : InstantiatorInterface
- Internal method to create the class instantiator, extracted to be mockable
- getReflectionService() : ReflectionService
- Lazy load ReflectionService.
- initializeObject() : void
- Call object initializer if present in object
- injectDependencies() : void
- Inject setter-dependencies into $instance
- instanciateObject() : object
- Instantiates an object, possibly setting the constructor dependencies.
Properties
$instantiator
protected
InstantiatorInterface
$instantiator
Methods
__construct()
public
__construct(ContainerInterface $psrContainer) : mixed
Parameters
- $psrContainer : ContainerInterface
getEmptyObject()
Create an instance of $className without calling its constructor
public
getEmptyObject(string|T> $className) : object|T
Parameters
- $className : string|T>
Return values
object|TgetImplementationClassName()
Returns the class name for a new instance, taking into account the class-extension API.
public
getImplementationClassName(string $className) : string
Parameters
- $className : string
-
Base class name to evaluate
Return values
string —Final class name to instantiate with "new [classname]
getInstance()
Main method which should be used to get an instance of the wished class specified by $className.
public
getInstance(string|T> $className[, array<string|int, mixed> $givenConstructorArguments = [] ]) : object|T
Parameters
- $className : string|T>
- $givenConstructorArguments : array<string|int, mixed> = []
-
the list of constructor arguments as array
Return values
object|T —the built object
registerImplementation()
register a classname that should be used if a dependency is required.
public
registerImplementation(string $className, string $alternativeClassName) : void
e.g. used to define default class for an interface
Parameters
- $className : string
- $alternativeClassName : string
Tags
getInstanceInternal()
Internal implementation for getting a class.
protected
getInstanceInternal(string|T> $className, array<int, mixed> ...$givenConstructorArguments) : object|T
Parameters
- $className : string|T>
- $givenConstructorArguments : array<int, mixed>
-
the list of constructor arguments as array
Tags
Return values
object|T —the built object
getInstantiator()
Internal method to create the class instantiator, extracted to be mockable
protected
getInstantiator() : InstantiatorInterface
Return values
InstantiatorInterfacegetReflectionService()
Lazy load ReflectionService.
protected
getReflectionService() : ReflectionService
Required as this class is being loaded in ext_localconf.php and we MUST not create caches in ext_localconf.php (which ReflectionService needs to do).
Return values
ReflectionServiceinitializeObject()
Call object initializer if present in object
protected
initializeObject(object $instance) : void
Parameters
- $instance : object
injectDependencies()
Inject setter-dependencies into $instance
protected
injectDependencies(object $instance, ClassSchema $classSchema) : void
Parameters
- $instance : object
- $classSchema : ClassSchema
instanciateObject()
Instantiates an object, possibly setting the constructor dependencies.
protected
instanciateObject(ClassSchema $classSchema, array<int, mixed> ...$givenConstructorArguments) : object
Additionally, directly registers all singletons in the singleton registry, such that circular references of singletons are correctly instantiated.
Parameters
- $classSchema : ClassSchema
- $givenConstructorArguments : array<int, mixed>
Tags
Return values
object —the new instance