PHP Класс Neos\Flow\ObjectManagement\ObjectManager

Наследование: implements Neos\Flow\ObjectManagement\ObjectManagerInterface
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$allSettings array An array of settings of all packages, indexed by package key
$cachedLowerCasedObjectNames array
$classesBeingInstantiated array
$context Neos\Flow\Core\ApplicationContext The configuration context for this Flow run
$dependencyProxies array
$internalShutdownObjects SplObjectStorage These shutdown method will be called after all other shutdown methods have been called.
$objectSerializer ObjectSerializer
$objects array
$shutdownObjects SplObjectStorage A SplObjectStorage containing those objects which need to be shutdown when the container shuts down. Each value of each entry is the respective shutdown method name.

Открытые методы

Метод Описание
__construct ( ApplicationContext $context ) Constructor for this Object Container
createLazyDependency ( string $hash, &$propertyReferenceVariable, string $className, Closure $builder ) : DependencyProxy Creates a new DependencyProxy class for a dependency built through code identified through "hash" for a dependency of class $className. The closure in $builder contains code for actually creating the dependency instance once it needs to be materialized.
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.
getAllObjectConfigurations ( ) : array Returns all current object configurations.
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 context Flow is running in.
getInstance ( string $objectName ) : object Returns the instance of the specified object or NULL if no instance has been registered yet.
getLazyDependencyByHash ( string $hash, &$propertyReferenceVariable ) : mixed This method is used internally to retrieve either an actual (singleton) instance of the specified dependency or, if no instance exists yet, a Dependency Proxy object which automatically triggers the creation of an instance as soon as it is used the first time.
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
getSettingsByPath ( array $settingsPath ) : mixed Returns the an array of package settings or a single setting value by the given path.
hasInstance ( string $objectName ) : boolean Returns TRUE if this object manager already has an instance for the specified object.
injectAllSettings ( array $settings ) : void Injects the global settings array, indexed by package key.
isRegistered ( string $objectName ) : boolean Returns TRUE if an object with the given name is 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
setObjects ( array $objects ) : void Sets the objects array
shutdown ( ) : void Shuts down this Object Container by calling the shutdown methods of all object instances which were configured to be shut down.

Защищенные методы

Метод Описание
buildObjectByFactory ( string $objectName ) : object Invokes the Factory defined in the object configuration of the specified object in order to build an instance. Arguments which were defined in the object configuration are passed to the factory method.
callShutdownMethods ( SplObjectStorage $shutdownObjects ) : void Executes the methods of the provided objects.
instantiateClass ( string $className, array $arguments ) : object Speed optimized alternative to ReflectionClass::newInstanceArgs()

Описание методов

__construct() публичный Метод

Constructor for this Object Container
public __construct ( ApplicationContext $context )
$context Neos\Flow\Core\ApplicationContext The configuration context for this Flow run

buildObjectByFactory() защищенный Метод

Invokes the Factory defined in the object configuration of the specified object in order to build an instance. Arguments which were defined in the object configuration are passed to the factory method.
protected buildObjectByFactory ( string $objectName ) : object
$objectName string Name of the object to build
Результат object The built object

callShutdownMethods() защищенный Метод

Executes the methods of the provided objects.
protected callShutdownMethods ( SplObjectStorage $shutdownObjects ) : void
$shutdownObjects SplObjectStorage
Результат void

createLazyDependency() публичный Метод

Internally used by the injectProperties method of generated proxy classes.
public createLazyDependency ( string $hash, &$propertyReferenceVariable, string $className, Closure $builder ) : DependencyProxy
$hash string An md5 hash over the code needed to actually build the dependency instance
$className string Name of the class of the dependency which eventually will be instantiated
$builder Closure An anonymous function which creates the instance to be injected
Результат Neos\Flow\ObjectManagement\DependencyInjection\DependencyProxy

forgetInstance() публичный Метод

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
Результат void

get() публичный Метод

Returns a fresh or existing instance of the object specified by $objectName.
public get ( string $objectName ) : object
$objectName string The name of the object to return an instance of
Результат object The object instance

getAllObjectConfigurations() публичный Метод

For internal use in bootstrap only. Can change anytime.
public getAllObjectConfigurations ( ) : array
Результат array

getCaseSensitiveObjectName() публичный Метод

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
Результат mixed Either the mixed case object name or FALSE if no object of that name was found.

getClassNameByObjectName() публичный Метод

Returns the implementation class name for the specified object
public getClassNameByObjectName ( string $objectName ) : string
$objectName string The object name
Результат string The class name corresponding to the given object name or FALSE if no such object is registered

getContext() публичный Метод

Returns the context Flow is running in.
public getContext ( ) : ApplicationContext
Результат Neos\Flow\Core\ApplicationContext The context, for example "Development" or "Production"

getInstance() публичный Метод

Returns the instance of the specified object or NULL if no instance has been registered yet.
public getInstance ( string $objectName ) : object
$objectName string The object name
Результат object The object or NULL

getLazyDependencyByHash() публичный Метод

Internally used by the injectProperties method of generated proxy classes.
public getLazyDependencyByHash ( string $hash, &$propertyReferenceVariable ) : mixed
$hash string
Результат mixed

getObjectNameByClassName() публичный Метод

Returns the object name corresponding to a given class name.
public getObjectNameByClassName ( string $className ) : string
$className string The class name
Результат string The object name corresponding to the given class name or FALSE if no object is configured to use that class

getPackageKeyByObjectName() публичный Метод

Returns the key of the package the specified object is contained in.
public getPackageKeyByObjectName ( string $objectName ) : string
$objectName string The object name
Результат string The package key or FALSE if no such object exists

getScope() публичный Метод

Returns the scope of the specified object.
public getScope ( string $objectName ) : integer
$objectName string The object name
Результат integer One of the Configuration::SCOPE_ constants

getSessionInstances() публичный Метод

Returns all instances of objects with scope session
public getSessionInstances ( ) : array
Результат array

getSettingsByPath() публичный Метод

Returns the an array of package settings or a single setting value by the given path.
public getSettingsByPath ( array $settingsPath ) : mixed
$settingsPath array Path to the setting(s) as an array, for example array('Neos', 'Flow', 'persistence', 'backendOptions')
Результат mixed Either an array of settings or the value of a single setting

hasInstance() публичный Метод

Returns TRUE if this object manager already has an instance for the specified object.
public hasInstance ( string $objectName ) : boolean
$objectName string The object name
Результат boolean TRUE if an instance already exists

injectAllSettings() публичный Метод

Injects the global settings array, indexed by package key.
public injectAllSettings ( array $settings ) : void
$settings array The global settings
Результат void

instantiateClass() защищенный Метод

Speed optimized alternative to ReflectionClass::newInstanceArgs()
protected instantiateClass ( string $className, array $arguments ) : object
$className string Name of the class to instantiate
$arguments array Arguments to pass to the constructor
Результат object The object

isRegistered() публичный Метод

Returns TRUE if an object with the given name is registered
public isRegistered ( string $objectName ) : boolean
$objectName string Name of the object
Результат boolean TRUE if the object has been registered, otherwise FALSE

registerShutdownObject() публичный Метод

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
Результат void

setInstance() публичный Метод

Objects of scope sessions are assumed to be the real session object, not the lazy loading proxy.
public setInstance ( string $objectName, object $instance ) : void
$objectName string The object name
$instance object A prebuilt instance
Результат void

setObjects() публичный Метод

Sets the objects array
public setObjects ( array $objects ) : void
$objects array An array of object names and some information about each registered object (scope, lower cased name etc.)
Результат void

shutdown() публичный Метод

Shuts down this Object Container by calling the shutdown methods of all object instances which were configured to be shut down.
public shutdown ( ) : void
Результат void

Описание свойств

$allSettings защищенное свойство

An array of settings of all packages, indexed by package key
protected array $allSettings
Результат array

$cachedLowerCasedObjectNames защищенное свойство

protected array $cachedLowerCasedObjectNames
Результат array

$classesBeingInstantiated защищенное свойство

protected array $classesBeingInstantiated
Результат array

$context защищенное свойство

The configuration context for this Flow run
protected ApplicationContext,Neos\Flow\Core $context
Результат Neos\Flow\Core\ApplicationContext

$dependencyProxies защищенное свойство

protected array $dependencyProxies
Результат array

$internalShutdownObjects защищенное свойство

These shutdown method will be called after all other shutdown methods have been called.
protected SplObjectStorage $internalShutdownObjects
Результат SplObjectStorage

$objectSerializer защищенное свойство

protected ObjectSerializer,Neos\Flow\ObjectManagement $objectSerializer
Результат ObjectSerializer

$objects защищенное свойство

protected array $objects
Результат array

$shutdownObjects защищенное свойство

A SplObjectStorage containing those objects which need to be shutdown when the container shuts down. Each value of each entry is the respective shutdown method name.
protected SplObjectStorage $shutdownObjects
Результат SplObjectStorage