AbstractProxyFactory
in package
Abstract factory for proxy objects.
Tags
Table of Contents
- AUTOGENERATE_ALWAYS = 1
- Always generates a new proxy in every request.
- AUTOGENERATE_EVAL = 3
- Generate the proxy classes using eval().
- AUTOGENERATE_FILE_NOT_EXISTS = 2
- Autogenerate the proxy class when the proxy file does not exist.
- AUTOGENERATE_NEVER = 0
- Never autogenerate a proxy and rely that it was generated by some process before deployment.
- $autoGenerate : bool
- $definitions : array<string|int, ProxyDefinition>
- $metadataFactory : ClassMetadataFactory
- $proxyGenerator : ProxyGenerator
- __construct() : mixed
- generateProxyClasses() : int
- Generates proxy classes for all given classes.
- getProxy() : Proxy
- Gets a reference proxy instance for the entity of the given type and identified by the given identifier.
- resetUninitializedProxy() : Proxy
- Reset initialization/cloning logic for an un-initialized proxy
- createProxyDefinition() : ProxyDefinition
- skipClass() : bool
- Determine if this class should be skipped during proxy generation.
- getProxyDefinition() : ProxyDefinition
- Get a proxy definition for the given class name.
Constants
AUTOGENERATE_ALWAYS
Always generates a new proxy in every request.
public
int
AUTOGENERATE_ALWAYS
= 1
This is only sane during development.
AUTOGENERATE_EVAL
Generate the proxy classes using eval().
public
int
AUTOGENERATE_EVAL
= 3
This strategy is only sane for development, and even then it gives me the creeps a little.
AUTOGENERATE_FILE_NOT_EXISTS
Autogenerate the proxy class when the proxy file does not exist.
public
int
AUTOGENERATE_FILE_NOT_EXISTS
= 2
This strategy causes a file exists call whenever any proxy is used the first time in a request.
AUTOGENERATE_NEVER
Never autogenerate a proxy and rely that it was generated by some process before deployment.
public
int
AUTOGENERATE_NEVER
= 0
Properties
$autoGenerate
private
bool
$autoGenerate
Whether to automatically (re)generate proxy classes.
$definitions
private
array<string|int, ProxyDefinition>
$definitions
= []
$metadataFactory
private
ClassMetadataFactory
$metadataFactory
$proxyGenerator
private
ProxyGenerator
$proxyGenerator
the proxy generator responsible for creating the proxy classes/files.
Methods
__construct()
public
__construct(ProxyGenerator $proxyGenerator, ClassMetadataFactory $metadataFactory, bool|int $autoGenerate) : mixed
Parameters
- $proxyGenerator : ProxyGenerator
- $metadataFactory : ClassMetadataFactory
- $autoGenerate : bool|int
Return values
mixed —generateProxyClasses()
Generates proxy classes for all given classes.
public
generateProxyClasses(array<string|int, ClassMetadata> $classes[, string $proxyDir = null ]) : int
Parameters
- $classes : array<string|int, ClassMetadata>
-
The classes (ClassMetadata instances) for which to generate proxies.
- $proxyDir : string = null
-
The target directory of the proxy classes. If not specified, the directory configured on the Configuration of the EntityManager used by this factory is used.
Return values
int —Number of generated proxies.
getProxy()
Gets a reference proxy instance for the entity of the given type and identified by the given identifier.
public
getProxy(string $className, array<string|int, mixed> $identifier) : Proxy
Parameters
- $className : string
- $identifier : array<string|int, mixed>
Tags
Return values
Proxy —resetUninitializedProxy()
Reset initialization/cloning logic for an un-initialized proxy
public
resetUninitializedProxy(Proxy $proxy) : Proxy
Parameters
- $proxy : Proxy
Tags
Return values
Proxy —createProxyDefinition()
protected
abstract createProxyDefinition(string $className) : ProxyDefinition
Parameters
- $className : string
Return values
ProxyDefinition —skipClass()
Determine if this class should be skipped during proxy generation.
protected
abstract skipClass(ClassMetadata $metadata) : bool
Parameters
- $metadata : ClassMetadata
Return values
bool —getProxyDefinition()
Get a proxy definition for the given class name.
private
getProxyDefinition(string $className) : ProxyDefinition
Parameters
- $className : string