ObjectManager

class \TYPO3\CMS\Extbase\Object\ObjectManager

Implements
ObjectManagerInterface

Implementation of the default Extbase Object Manager

Deprecated

since v11, will be removed in v12. Use symfony DI and GeneralUtility::makeInstance() instead. See TYPO3 explained documentation for more information.

Table of Contents

Interfaces

ObjectManagerInterface
Interface for the TYPO3 Object Manager

Properties

$objectContainer  : Container

Methods

__construct()  : mixed
Constructs a new Object Manager
__sleep()  : array
Serialization (sleep) helper.
__wakeup()  : mixed
Unserialization (wakeup) helper.
get()  : T
Returns a fresh or existing instance of the class specified by $className.
getEmptyObject()  : T
Creates an instance of $className without calling its constructor.

Properties

Methods

__construct()

Constructs a new Object Manager

public __construct(ContainerInterface $container, Container $objectContainer) : mixed

Parameters

$container : ContainerInterface
$objectContainer : Container

__sleep()

Serialization (sleep) helper.

public __sleep() : array

Removes properties of this object from serialization. This action is necessary, since there might be closures used in the accordant content objects (e.g. in FLUIDTEMPLATE) which cannot be serialized. It's fine to reset $this->contentObjects since elements will be recreated and are just a local cache, but not required for runtime logic and behaviour.

Tags

see
https://forge.typo3.org/issues/36820

Return values

array —

Names of the properties to be serialized

__wakeup()

Unserialization (wakeup) helper.

public __wakeup() : mixed

Initializes the properties again that have been removed by a call to the __sleep() method on serialization before.

Tags

see
https://forge.typo3.org/issues/36820

get()

Returns a fresh or existing instance of the class specified by $className.

public get(class-string $className, array ...$constructorArguments) : T

Deprecated

since TYPO3 10.4, will be removed in version 12.0

Parameters

$className : class-string

the name of the class to return an instance of

$constructorArguments : array

Tags

template

Return values

T —

the class instance

getEmptyObject()

Creates an instance of $className without calling its constructor.

public getEmptyObject(class-string $className) : T

Deprecated

since v11, will be removed in v12. Does NOT log, has a v11 deprecation.rst file. Used in DataMapper, will be removed as breaking change in v12. Also drop doctrine/instantiator.

Parameters

$className : class-string

the name of the class to return an instance of

Tags

template

Return values

T —

the class instance

On this page