PHP Class Neos\Flow\ObjectManagement\DependencyInjection\ProxyClassBuilder

Afficher le fichier Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Свойство Type Description
$compiler Neos\Flow\ObjectManagement\Proxy\Compiler
$configurationManager Neos\Flow\Configuration\ConfigurationManager
$objectConfigurations array
$objectManager Neos\Flow\ObjectManagement\CompileTimeObjectManager
$reflectionService Neos\Flow\Reflection\ReflectionService
$systemLogger Neos\Flow\Log\SystemLoggerInterface

Méthodes publiques

Méthode Description
build ( ) : void Analyzes the Object Configuration provided by the compiler and builds the necessary PHP code for the proxy classes to realize dependency injection.
buildPropertyInjectionCodeByConfigurationTypeAndPath ( Configuration $objectConfiguration, string $propertyName, string $configurationType, string $configurationPath = null ) : array Builds code which assigns the value stored in the specified configuration into the given class property.
buildPropertyInjectionCodeByString ( Configuration $objectConfiguration, Neos\Flow\ObjectManagement\Configuration\ConfigurationProperty $propertyConfiguration, string $propertyName, string $propertyObjectName ) : array Builds code which injects an object which was specified by its object name
injectCompiler ( Compiler $compiler ) : void
injectConfigurationManager ( ConfigurationManager $configurationManager ) : void
injectObjectManager ( CompileTimeObjectManager $objectManager ) : void
injectReflectionService ( ReflectionService $reflectionService ) : void
injectSystemLogger ( Neos\Flow\Log\SystemLoggerInterface $systemLogger ) : void

Méthodes protégées

Méthode Description
buildConstructorInjectionCode ( Configuration $objectConfiguration ) : string Renders additional code for the __construct() method of the Proxy Class which realizes constructor injection.
buildCustomFactoryCall ( string $customFactoryObjectName, string $customFactoryMethodName, array $arguments ) : string
buildLazyPropertyInjectionCode ( string $propertyObjectName, string $propertyClassName, string $propertyName, string $preparedSetterArgument ) : array Builds code which injects a DependencyProxy instead of the actual dependency
buildLifecycleInitializationCode ( Configuration $objectConfiguration, integer $cause ) : string Builds code which calls the lifecycle initialization method, if any.
buildLifecycleShutdownCode ( Configuration $objectConfiguration ) : string Builds code which registers the lifecycle shutdown method, if any.
buildMethodParametersCode ( array $argumentConfigurations ) : string FIXME: Not yet completely refactored to new proxy mechanism
buildPropertyInjectionCode ( Configuration $objectConfiguration ) : string Builds the code necessary to inject setter based dependencies.
buildPropertyInjectionCodeByConfiguration ( Configuration $objectConfiguration, string $propertyName, Configuration $propertyConfiguration ) : array Builds code which injects an object which was specified by its object configuration
buildSerializeRelatedEntitiesCode ( Configuration $objectConfiguration ) : string Renders code to create identifier/type information from related entities in an object.
buildSetInstanceCode ( Configuration $objectConfiguration ) : string Renders additional code which registers the instance of the proxy class at the Object Manager before constructor injection is executed. Used in constructors and wakeup methods.
buildSetterInjectionCode ( string $className, string $propertyName, string $preparedSetterArgument ) : array Builds a code snippet which tries to inject the specified property first through calling the related inject*() method and then the set*() method. If neither exists and the property doesn't exist either, an empty array is returned.
compileStaticMethods ( string $className, ProxyClass $proxyClass ) : void Compile the result of methods marked with CompileStatic into the proxy class

Method Details

build() public méthode

Analyzes the Object Configuration provided by the compiler and builds the necessary PHP code for the proxy classes to realize dependency injection.
public build ( ) : void
Résultat void

buildConstructorInjectionCode() protected méthode

Renders additional code for the __construct() method of the Proxy Class which realizes constructor injection.
protected buildConstructorInjectionCode ( Configuration $objectConfiguration ) : string
$objectConfiguration Neos\Flow\ObjectManagement\Configuration\Configuration
Résultat string The built code

buildCustomFactoryCall() protected méthode

protected buildCustomFactoryCall ( string $customFactoryObjectName, string $customFactoryMethodName, array $arguments ) : string
$customFactoryObjectName string
$customFactoryMethodName string
$arguments array
Résultat string

buildLazyPropertyInjectionCode() protected méthode

Builds code which injects a DependencyProxy instead of the actual dependency
protected buildLazyPropertyInjectionCode ( string $propertyObjectName, string $propertyClassName, string $propertyName, string $preparedSetterArgument ) : array
$propertyObjectName string Object name of the dependency to inject
$propertyClassName string Class name of the dependency to inject
$propertyName string Name of the property in the class to inject into
$preparedSetterArgument string PHP code to use for retrieving the value to inject
Résultat array PHP code

buildLifecycleInitializationCode() protected méthode

Builds code which calls the lifecycle initialization method, if any.
protected buildLifecycleInitializationCode ( Configuration $objectConfiguration, integer $cause ) : string
$objectConfiguration Neos\Flow\ObjectManagement\Configuration\Configuration
$cause integer a \Neos\Flow\ObjectManagement\ObjectManagerInterface::INITIALIZATIONCAUSE_* constant which is the cause of the initialization command being called.
Résultat string

buildLifecycleShutdownCode() protected méthode

Builds code which registers the lifecycle shutdown method, if any.
protected buildLifecycleShutdownCode ( Configuration $objectConfiguration ) : string
$objectConfiguration Neos\Flow\ObjectManagement\Configuration\Configuration
Résultat string

buildMethodParametersCode() protected méthode

FIXME: Not yet completely refactored to new proxy mechanism
protected buildMethodParametersCode ( array $argumentConfigurations ) : string
$argumentConfigurations array
Résultat string

buildPropertyInjectionCode() protected méthode

Builds the code necessary to inject setter based dependencies.
protected buildPropertyInjectionCode ( Configuration $objectConfiguration ) : string
$objectConfiguration Neos\Flow\ObjectManagement\Configuration\Configuration (needed to produce helpful exception message)
Résultat string The built code

buildPropertyInjectionCodeByConfiguration() protected méthode

Builds code which injects an object which was specified by its object configuration
protected buildPropertyInjectionCodeByConfiguration ( Configuration $objectConfiguration, string $propertyName, Configuration $propertyConfiguration ) : array
$objectConfiguration Neos\Flow\ObjectManagement\Configuration\Configuration Configuration of the object to inject into
$propertyName string Name of the property to inject
$propertyConfiguration Neos\Flow\ObjectManagement\Configuration\Configuration Configuration of the object to inject
Résultat array PHP code

buildPropertyInjectionCodeByConfigurationTypeAndPath() public méthode

Builds code which assigns the value stored in the specified configuration into the given class property.
public buildPropertyInjectionCodeByConfigurationTypeAndPath ( Configuration $objectConfiguration, string $propertyName, string $configurationType, string $configurationPath = null ) : array
$objectConfiguration Neos\Flow\ObjectManagement\Configuration\Configuration Configuration of the object to inject into
$propertyName string Name of the property to inject
$configurationType string the configuration type of the injected property (one of the ConfigurationManager::CONFIGURATION_TYPE_* constants)
$configurationPath string Path with "." as separator specifying the setting value to inject or NULL if the complete configuration array should be injected
Résultat array PHP code

buildPropertyInjectionCodeByString() public méthode

Builds code which injects an object which was specified by its object name
public buildPropertyInjectionCodeByString ( Configuration $objectConfiguration, Neos\Flow\ObjectManagement\Configuration\ConfigurationProperty $propertyConfiguration, string $propertyName, string $propertyObjectName ) : array
$objectConfiguration Neos\Flow\ObjectManagement\Configuration\Configuration Configuration of the object to inject into
$propertyConfiguration Neos\Flow\ObjectManagement\Configuration\ConfigurationProperty
$propertyName string Name of the property to inject
$propertyObjectName string Object name of the object to inject
Résultat array PHP code

buildSerializeRelatedEntitiesCode() protected méthode

Used in sleep methods.
protected buildSerializeRelatedEntitiesCode ( Configuration $objectConfiguration ) : string
$objectConfiguration Neos\Flow\ObjectManagement\Configuration\Configuration
Résultat string

buildSetInstanceCode() protected méthode

This also makes sure that object creation does not end in an endless loop due to bi-directional dependencies.
protected buildSetInstanceCode ( Configuration $objectConfiguration ) : string
$objectConfiguration Neos\Flow\ObjectManagement\Configuration\Configuration
Résultat string

buildSetterInjectionCode() protected méthode

If neither inject*() nor set*() exists, but the property does exist, NULL is returned
protected buildSetterInjectionCode ( string $className, string $propertyName, string $preparedSetterArgument ) : array
$className string Name of the class to inject into
$propertyName string Name of the property to inject
$preparedSetterArgument string PHP code to use for retrieving the value to inject
Résultat array PHP code

compileStaticMethods() protected méthode

Compile the result of methods marked with CompileStatic into the proxy class
protected compileStaticMethods ( string $className, ProxyClass $proxyClass ) : void
$className string
$proxyClass Neos\Flow\ObjectManagement\Proxy\ProxyClass
Résultat void

injectCompiler() public méthode

public injectCompiler ( Compiler $compiler ) : void
$compiler Neos\Flow\ObjectManagement\Proxy\Compiler
Résultat void

injectConfigurationManager() public méthode

public injectConfigurationManager ( ConfigurationManager $configurationManager ) : void
$configurationManager Neos\Flow\Configuration\ConfigurationManager
Résultat void

injectObjectManager() public méthode

public injectObjectManager ( CompileTimeObjectManager $objectManager ) : void
$objectManager Neos\Flow\ObjectManagement\CompileTimeObjectManager
Résultat void

injectReflectionService() public méthode

public injectReflectionService ( ReflectionService $reflectionService ) : void
$reflectionService Neos\Flow\Reflection\ReflectionService
Résultat void

injectSystemLogger() public méthode

public injectSystemLogger ( Neos\Flow\Log\SystemLoggerInterface $systemLogger ) : void
$systemLogger Neos\Flow\Log\SystemLoggerInterface
Résultat void

Property Details

$compiler protected_oe property

protected Compiler,Neos\Flow\ObjectManagement\Proxy $compiler
Résultat Neos\Flow\ObjectManagement\Proxy\Compiler

$configurationManager protected_oe property

protected ConfigurationManager,Neos\Flow\Configuration $configurationManager
Résultat Neos\Flow\Configuration\ConfigurationManager

$objectConfigurations protected_oe property

protected array $objectConfigurations
Résultat array

$objectManager protected_oe property

protected CompileTimeObjectManager,Neos\Flow\ObjectManagement $objectManager
Résultat Neos\Flow\ObjectManagement\CompileTimeObjectManager

$reflectionService protected_oe property

protected ReflectionService,Neos\Flow\Reflection $reflectionService
Résultat Neos\Flow\Reflection\ReflectionService

$systemLogger protected_oe property

protected SystemLoggerInterface,Neos\Flow\Log $systemLogger
Résultat Neos\Flow\Log\SystemLoggerInterface