PHP Interface Neos\Flow\ObjectManagement\ObjectManagerInterface

Datei anzeigen Open project: neos/flow-development-collection Interface Usage Examples

Public Methods

Method Description
forgetInstance ( string $objectName ) : void Unsets the instance of the given object
get ( string $objectName ) : object Returns a fresh or existing instance of the object specified by $objectName.
getCaseSensitiveObjectName ( string $caseInsensitiveObjectName ) : mixed Returns the case sensitive object name of an object specified by a case insensitive object name. If no object of that name exists, FALSE is returned.
getClassNameByObjectName ( string $objectName ) : string Returns the implementation class name for the specified object
getContext ( ) : ApplicationContext Returns the currently set context.
getObjectNameByClassName ( string $className ) : string Returns the object name corresponding to a given class name.
getPackageKeyByObjectName ( string $objectName ) : string Returns the key of the package the specified object is contained in.
getScope ( string $objectName ) : integer Returns the scope of the specified object.
getSessionInstances ( ) : array Returns all instances of objects with scope session
isRegistered ( string $objectName ) : boolean Returns TRUE if an object with the given name has already been registered.
registerShutdownObject ( object $object, string $shutdownLifecycleMethodName ) : void Registers the passed shutdown lifecycle method for the given object
setInstance ( string $objectName, object $instance ) : void Sets the instance of the given object
shutdown ( ) : void Shuts the object manager down and calls the shutdown methods of all objects which are configured for it.

Method Details

forgetInstance() public method

If run during standard runtime, the whole application might become unstable because certain parts might already use an instance of this object. Therefore this method should only be used in a setUp() method of a functional test case.
public forgetInstance ( string $objectName ) : void
$objectName string The object name
return void

get() public method

Important: If possible, instances of Prototype objects should always be created with the new keyword and Singleton objects should rather be injected by some type of Dependency Injection.
public get ( string $objectName ) : object
$objectName string The name of the object to return an instance of
return object The object instance

getCaseSensitiveObjectName() public method

In general, the case sensitive variant is used everywhere in Flow, however there might be special situations in which the case sensitive name is not available. This method helps you in these rare cases.
public getCaseSensitiveObjectName ( string $caseInsensitiveObjectName ) : mixed
$caseInsensitiveObjectName string The object name in lower-, upper- or mixed case
return mixed Either the mixed case object name or FALSE if no object of that name was found.

getClassNameByObjectName() public method

Returns the implementation class name for the specified object
public getClassNameByObjectName ( string $objectName ) : string
$objectName string The object name
return string The class name corresponding to the given object name or FALSE if no such object is registered

getContext() public method

Returns the currently set context.
public getContext ( ) : ApplicationContext
return Neos\Flow\Core\ApplicationContext the current context

getObjectNameByClassName() public method

Returns the object name corresponding to a given class name.
public getObjectNameByClassName ( string $className ) : string
$className string The class name
return string The object name corresponding to the given class name

getPackageKeyByObjectName() public method

Returns the key of the package the specified object is contained in.
public getPackageKeyByObjectName ( string $objectName ) : string
$objectName string The object name
return string The package key or FALSE if no such object exists

getScope() public method

Returns the scope of the specified object.
public getScope ( string $objectName ) : integer
$objectName string The object name
return integer One of the Configuration::SCOPE_ constants

getSessionInstances() public method

Returns all instances of objects with scope session
public getSessionInstances ( ) : array
return array

isRegistered() public method

Returns TRUE if an object with the given name has already been registered.
Since: 1.0.0 alpha 8
public isRegistered ( string $objectName ) : boolean
$objectName string Name of the object
return boolean TRUE if the object has been registered, otherwise FALSE

registerShutdownObject() public method

Registers the passed shutdown lifecycle method for the given object
public registerShutdownObject ( object $object, string $shutdownLifecycleMethodName ) : void
$object object The object to register the shutdown method for
$shutdownLifecycleMethodName string The method name of the shutdown method to be called
return void

setInstance() public method

Sets the instance of the given object
public setInstance ( string $objectName, object $instance ) : void
$objectName string The object name
$instance object A prebuilt instance
return void

shutdown() public method

Shuts the object manager down and calls the shutdown methods of all objects which are configured for it.
public shutdown ( ) : void
return void