| Methods |
public
|
__construct(string $proxyDirectory, string $proxyNamespace)
Initializes a new instance of the <tt>ProxyFactory</tt> class that is
connected to the given <tt>EntityManager</tt>.
Initializes a new instance of the ProxyFactory class that is
connected to the given EntityManager.
Parameters
| $proxyDirectory |
The directory to use for the proxy classes. It must exist.
|
| $proxyNamespace |
The namespace to use for the proxy classes.
|
Throws
|
#
|
public
|
setPlaceholder(string $name, string|callable $placeholder)
Sets a placeholder to be replaced in the template.
Sets a placeholder to be replaced in the template.
Throws
|
#
|
public
|
setProxyClassTemplate(string $proxyClassTemplate)
Sets the base template used to create proxy classes.
Sets the base template used to create proxy classes.
|
#
|
public
|
generateProxyClass(ClassMetadata $class, string|bool $fileName = false)
Generates a proxy class file.
Generates a proxy class file.
Parameters
| $class |
Metadata for the original class.
|
| $fileName |
Filename (full path) for the generated class. If none is given, eval() is used.
|
Throws
|
#
|
private
|
verifyClassCanBeProxied(ClassMetadata $class)
|
#
|
private
|
generateProxyShortClassName(ClassMetadata $class): string
Generates the proxy short class name to be used in the template.
Generates the proxy short class name to be used in the template.
|
#
|
private
|
generateNamespace(ClassMetadata $class): string
Generates the proxy namespace.
Generates the proxy namespace.
|
#
|
public
|
generateEnumUseStatements(ClassMetadata $class): string
Enums must have a use statement when used as public property defaults.
Enums must have a use statement when used as public property defaults.
|
#
|
private
|
generateClassName(ClassMetadata $class): string
Generates the original class name.
Generates the original class name.
|
#
|
private
|
generateLazyPropertiesNames(ClassMetadata $class): string
Generates the array representation of lazy loaded public properties and their default values.
Generates the array representation of lazy loaded public properties and their default values.
|
#
|
private
|
generateLazyPropertiesDefaults(ClassMetadata $class): string
Generates the array representation of lazy loaded public properties names.
Generates the array representation of lazy loaded public properties names.
|
#
|
private
|
generateConstructorImpl(ClassMetadata $class): string
Generates the constructor code (un-setting public lazy loaded properties, setting identifier field values).
Generates the constructor code (un-setting public lazy loaded properties, setting identifier field values).
|
#
|
private
|
generateMagicGet(ClassMetadata $class): string
Generates the magic getter invoked when lazy loaded public properties are requested.
Generates the magic getter invoked when lazy loaded public properties are requested.
|
#
|
private
|
generateMagicSet(ClassMetadata $class): string
Generates the magic setter (currently unused).
Generates the magic setter (currently unused).
|
#
|
private
|
generateMagicIsset(ClassMetadata $class): string
Generates the magic issetter invoked when lazy loaded public properties are checked against isset().
Generates the magic issetter invoked when lazy loaded public properties are checked against isset().
|
#
|
private
|
generateSleepImpl(ClassMetadata $class): string
Generates implementation for the `__sleep` method of proxies.
Generates implementation for the __sleep method of proxies.
|
#
|
private
|
generateWakeupImpl(ClassMetadata $class): string
Generates implementation for the `__wakeup` method of proxies.
Generates implementation for the __wakeup method of proxies.
|
#
|
private
|
generateCloneImpl(ClassMetadata $class): string
Generates implementation for the `__clone` method of proxies.
Generates implementation for the __clone method of proxies.
|
#
|
private
|
generateMethods(ClassMetadata $class): string
Generates decorated methods by picking those available in the parent class.
Generates decorated methods by picking those available in the parent class.
|
#
|
public
|
getProxyFileName(class-string $className, string $baseDirectory = null): string
Generates the Proxy file name.
Generates the Proxy file name.
Parameters
| $baseDirectory |
Optional base directory for proxy file name generation.
If not specified, the directory configured on the Configuration of the
EntityManager will be used by this factory.
|
|
#
|
private
|
isShortIdentifierGetter(ReflectionMethod $method, ClassMetadata $class): bool
Checks if the method is a short identifier getter.
Checks if the method is a short identifier getter.
What does this mean? For proxy objects the identifier is already known,
however accessing the getter for this identifier usually triggers the
lazy loading, leading to a query that may not be necessary if only the
ID is interesting for the userland code (for example in views that
generate links to the entity, but do not display anything else).
|
#
|
private
|
getLazyLoadedPublicPropertiesNames(ClassMetadata $class): array<int, string>
Generates the list of public properties to be lazy loaded.
Generates the list of public properties to be lazy loaded.
|
#
|
private
|
getLazyLoadedPublicProperties(ClassMetadata $class): mixed[]
Generates the list of default values of public properties.
Generates the list of default values of public properties.
|
#
|
private
|
buildParametersString(ReflectionParameter[] $parameters, string[] $renameParameters = []): string
|
#
|
private
|
getParameterType(ReflectionParameter $parameter): string|null
|
#
|
private
|
getParameterDefaultValue(ReflectionParameter $parameter): string
|
#
|
private
|
getParameterNamesForInvoke(ReflectionParameter[] $parameters): string[]
|
#
|
private
|
getParameterNamesForParentCall(ReflectionParameter[] $parameters): string[]
|
#
|
private
|
getMethodReturnType(ReflectionMethod $method): string
|
#
|
private
|
shouldProxiedMethodReturn(ReflectionMethod $method): bool
|
#
|
private
|
formatType(ReflectionType $type, ReflectionMethod $method, ?ReflectionParameter $parameter = null): string
|
#
|