TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Extbase\Object\ObjectManager Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Object\ObjectManager:
TYPO3\CMS\Extbase\Object\ObjectManagerInterface TYPO3\CMS\Core\SingletonInterface Tx_Extbase_Object_ObjectManager

Public Member Functions

 __construct ()
 
 __sleep ()
 
 __wakeup ()
 
 isRegistered ($objectName)
 
 get ($objectName)
 
 getScope ($objectName)
 
 create ($objectName)
 
 getEmptyObject ($className)
 

Protected Attributes

 $objectContainer
 

Detailed Description

Implementation of the default Extbase Object Manager

Definition at line 22 of file ObjectManager.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructs a new Object Manager

Definition at line 32 of file ObjectManager.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

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

Member Function Documentation

◆ __sleep()

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
http://forge.typo3.org/issues/36820
Returns
array Names of the properties to be serialized

Definition at line 49 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
http://forge.typo3.org/issues/36820
Returns
void

Definition at line 66 of file ObjectManager.php.

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

◆ create()

TYPO3\CMS\Extbase\Object\ObjectManager::create (   $objectName)

Creates a fresh instance of the object specified by $objectName.

This factory method can only create objects of the scope prototype. Singleton objects must be either injected by some type of Dependency Injection or if that is not possible, be retrieved by the get() method of the Object Manager

Parameters
string$objectNameThe name of the object to create
Returns
object The new object instance
Deprecated:
since Extbase 6.1.0; will be removed in Extbase 6.3.0

Implements TYPO3\CMS\Extbase\Object\ObjectManagerInterface.

Definition at line 126 of file ObjectManager.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\logDeprecatedFunction().

◆ get()

TYPO3\CMS\Extbase\Object\ObjectManager::get (   $objectName)

Returns a fresh or existing instance of the object specified by $objectName.

Parameters
string$objectNameThe name of the object to return an instance of
Returns
object The object instance

Implements TYPO3\CMS\Extbase\Object\ObjectManagerInterface.

Definition at line 87 of file ObjectManager.php.

◆ getEmptyObject()

TYPO3\CMS\Extbase\Object\ObjectManager::getEmptyObject (   $className)

Create an instance of $className without calling its constructor

Parameters
string$className
Returns
object

Implements TYPO3\CMS\Extbase\Object\ObjectManagerInterface.

Definition at line 140 of file ObjectManager.php.

◆ getScope()

TYPO3\CMS\Extbase\Object\ObjectManager::getScope (   $objectName)

Returns the scope of the specified object.

Parameters
string$objectNameThe object name
Returns
integer One of the Container::SCOPE_ constants
Exceptions

Implements TYPO3\CMS\Extbase\Object\ObjectManagerInterface.

Definition at line 107 of file ObjectManager.php.

References TYPO3\CMS\Extbase\Object\ObjectManager\isRegistered(), TYPO3\CMS\Extbase\Object\Container\Container\SCOPE_PROTOTYPE, and TYPO3\CMS\Extbase\Object\Container\Container\SCOPE_SINGLETON.

◆ isRegistered()

TYPO3\CMS\Extbase\Object\ObjectManager::isRegistered (   $objectName)

Returns TRUE if an object with the given name is registered

Parameters
string$objectNameName of the object
Returns
boolean TRUE if the object has been registered, otherwise FALSE

Implements TYPO3\CMS\Extbase\Object\ObjectManagerInterface.

Definition at line 76 of file ObjectManager.php.

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

Member Data Documentation

◆ $objectContainer

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

Definition at line 27 of file ObjectManager.php.