ObjectCreator
in package
implements
DefinitionResolver
Create objects based on an object definition.
Tags
Table of Contents
Interfaces
- DefinitionResolver
- Resolves a definition to a value.
Properties
- $definitionResolver : DefinitionResolver
- $parameterResolver : ParameterResolver
- $proxyFactory : ProxyFactory
Methods
- __construct() : mixed
- isResolvable() : bool
- The definition is not resolvable if the class is not instantiable (interface or abstract) or if the class doesn't exist.
- resolve() : mixed
- Resolve a class definition to a value.
- setPrivatePropertyValue() : void
- injectMethodsAndProperties() : void
- createInstance() : object
- Creates an instance of the class and injects dependencies.
- createProxy() : LazyLoadingInterface
- Returns a proxy instance.
- injectProperty() : void
- Inject dependencies into properties.
Properties
$definitionResolver
private
DefinitionResolver
$definitionResolver
$parameterResolver
private
ParameterResolver
$parameterResolver
$proxyFactory
private
ProxyFactory
$proxyFactory
Methods
__construct()
public
__construct(DefinitionResolver $definitionResolver, ProxyFactory $proxyFactory) : mixed
Parameters
- $definitionResolver : DefinitionResolver
-
Used to resolve nested definitions.
- $proxyFactory : ProxyFactory
-
Used to create proxies for lazy injections.
isResolvable()
The definition is not resolvable if the class is not instantiable (interface or abstract) or if the class doesn't exist.
public
isResolvable(ObjectDefinition $definition[, array<string|int, mixed> $parameters = [] ]) : bool
Parameters
- $definition : ObjectDefinition
- $parameters : array<string|int, mixed> = []
-
Optional parameters to use to build the entry.
Return values
boolresolve()
Resolve a class definition to a value.
public
resolve(ObjectDefinition $definition[, array<string|int, mixed> $parameters = [] ]) : mixed
This will create a new instance of the class using the injections points defined.
Parameters
- $definition : ObjectDefinition
- $parameters : array<string|int, mixed> = []
-
Optional parameters to use to build the entry.
Return values
mixed —Value obtained from the definition.
setPrivatePropertyValue()
public
static setPrivatePropertyValue(string|null $className, mixed $object, string $propertyName, mixed $propertyValue) : void
Parameters
- $className : string|null
- $object : mixed
- $propertyName : string
- $propertyValue : mixed
injectMethodsAndProperties()
protected
injectMethodsAndProperties(object $object, ObjectDefinition $objectDefinition) : void
Parameters
- $object : object
- $objectDefinition : ObjectDefinition
createInstance()
Creates an instance of the class and injects dependencies.
private
createInstance(ObjectDefinition $definition, array<string|int, mixed> $parameters) : object
.
Parameters
- $definition : ObjectDefinition
- $parameters : array<string|int, mixed>
-
Optional parameters to use to create the instance.
Tags
Return values
objectcreateProxy()
Returns a proxy instance.
private
createProxy(ObjectDefinition $definition, array<string|int, mixed> $parameters) : LazyLoadingInterface
Parameters
- $definition : ObjectDefinition
- $parameters : array<string|int, mixed>
Return values
LazyLoadingInterfaceinjectProperty()
Inject dependencies into properties.
private
injectProperty(object $object, PropertyInjection $propertyInjection) : void
Parameters
- $object : object
-
Object to inject dependencies into
- $propertyInjection : PropertyInjection
-
Property injection definition