‪TYPO3CMS  10.4
TYPO3\CMS\Extbase\Object\ObjectManager Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Object\ObjectManager:
TYPO3\CMS\Extbase\Object\ObjectManagerInterface TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 __construct (ContainerInterface $container, ExtbaseContainer $objectContainer)
 
array __sleep ()
 
 __wakeup ()
 
object &T get (string $className,... $constructorArguments)
 
object &T getEmptyObject (string $className)
 

Protected Attributes

ExtbaseContainer $objectContainer
 

Private Attributes

ContainerInterface $container
 

Detailed Description

Implementation of the default Extbase Object Manager

Definition at line 27 of file ObjectManager.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Extbase\Object\ObjectManager::__construct ( ContainerInterface  $container,
ExtbaseContainer  $objectContainer 
)

Constructs a new Object Manager

Parameters
ContainerInterface$container
ExtbaseContainer$objectContainer

Definition at line 43 of file ObjectManager.php.

References TYPO3\CMS\Extbase\Object\ObjectManager\$container, and TYPO3\CMS\Extbase\Object\ObjectManager\$objectContainer.

Referenced by TYPO3\CMS\Extbase\Object\ObjectManager\__wakeup().

Member Function Documentation

◆ __sleep()

array TYPO3\CMS\Extbase\Object\ObjectManager::__sleep ( )

Serialization (sleep) helper.

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.

See also
https://forge.typo3.org/issues/36820
Returns
‪array Names of the properties to be serialized

only to be used within Extbase, not part of TYPO3 Core API.

Definition at line 63 of file ObjectManager.php.

◆ __wakeup()

TYPO3\CMS\Extbase\Object\ObjectManager::__wakeup ( )

Unserialization (wakeup) helper.

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

See also
https://forge.typo3.org/issues/36820

only to be used within Extbase, not part of TYPO3 Core API.

Definition at line 77 of file ObjectManager.php.

References TYPO3\CMS\Extbase\Object\ObjectManager\__construct().

◆ get()

object& T TYPO3\CMS\Extbase\Object\ObjectManager::get ( string  $className,
  $constructorArguments 
)

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

@template T

Parameters
class-string<T>‪$className the name of the class to return an instance of
array‪...$constructorArguments
Returns
‪object&T the class instance
Deprecated:
‪since TYPO3 10.4, will be removed in version 12.0

Implements TYPO3\CMS\Extbase\Object\ObjectManagerInterface.

Definition at line 97 of file ObjectManager.php.

Referenced by TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\executeUpdate(), TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\AbstractValidator\getConfigurationService(), TYPO3\CMS\Form\Domain\Configuration\FormDefinitionValidationService\getConfigurationService(), and TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\updateNecessary().

◆ getEmptyObject()

object& T TYPO3\CMS\Extbase\Object\ObjectManager::getEmptyObject ( string  $className)

Creates an instance of $className without calling its constructor.

@template T

Parameters
class-string<T>‪$className the name of the class to return an instance of
Returns
‪object&T the class instance

Implements TYPO3\CMS\Extbase\Object\ObjectManagerInterface.

Definition at line 128 of file ObjectManager.php.

Member Data Documentation

◆ $container

ContainerInterface TYPO3\CMS\Extbase\Object\ObjectManager::$container
private

◆ $objectContainer

ExtbaseContainer TYPO3\CMS\Extbase\Object\ObjectManager::$objectContainer
protected